--- title: Quick Start id: quick-start --- The basic angular app example to get started with the TanStack angular-store. **app.component.ts** ```angular-ts import { Component } from '@angular/core' import { DisplayComponent } from './display.component' import { IncrementComponent } from './increment.component' @Component({ selector: 'app-root', imports: [DisplayComponent, IncrementComponent], template: `

How many of your friends like cats or dogs?

Press one of the buttons to add a counter of how many of your friends like cats or dogs

`, }) export class AppComponent {} ``` **store.ts** ```typescript import { createStore } from '@tanstack/angular-store'; // You can instantiate the store outside of Angular components too! export const store = createStore({ dogs: 0, cats: 0, }); export function updateState(animal: 'dogs' | 'cats') { store.setState((state) => { return { ...state, [animal]: state[animal] + 1, }; }); } ``` **display.component.ts** ```angular-ts import { injectSelector } from '@tanstack/angular-store'; import { store } from './store'; @Component({ selector: 'app-display', template: `
{{ animal() }}: {{ count() }}
`, standalone: true }) export class Display { animal = input.required(); count = injectSelector(store, (state) => state[this.animal()]); } ``` **increment.component.ts** ```angular-ts import { injectStore } from '@tanstack/angular-store'; import { store, updateState } from './store'; @Component({ selector: 'app-increment', template: ` `, standalone: true }) export class Increment { animal = input.required(); updateState = updateState; } ``` `injectStore` remains available as a deprecated alias to `injectSelector`.