Skip to content

Instantly share code, notes, and snippets.

@splincode
Created August 31, 2019 19:03
Show Gist options
  • Save splincode/9cdd6c5bba8360988d045db40a7fb22a to your computer and use it in GitHub Desktop.
Save splincode/9cdd6c5bba8360988d045db40a7fb22a to your computer and use it in GitHub Desktop.
import { State, Action } from '@ngxs/store';
import { Increment, Decrement } from './count.actions';
@State<number>({
name: 'count',
defaults: 0
})
export class CountState {
@Action(Increment) public increment({ setState }) {
setState(state => ++state);
}
@Action(Decrement) public decrement({ setState }) {
setState(state => --state);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment