Skip to content

Instantly share code, notes, and snippets.

@splincode
Last active January 2, 2019 14:12
Show Gist options
  • Save splincode/a8bcc0f1cf2dc17b60c3a5a9ba62e54a to your computer and use it in GitHub Desktop.
Save splincode/a8bcc0f1cf2dc17b60c3a5a9ba62e54a to your computer and use it in GitHub Desktop.
@State<string[]>({
name: 'animals',
defaults: []
})
export class AnimalsState {
@Receiver()
public static addAnimal(ctx: StateContext<string[]>, action: EmitterAction<string>) {
ctx.setState((state) => [ ...state, action.payload ]);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment