Skip to content

Instantly share code, notes, and snippets.

@JeremyLikness
Created July 30, 2016 15:12
Show Gist options
  • Select an option

  • Save JeremyLikness/f3d00edcabced5182dacec7cedc57fb1 to your computer and use it in GitHub Desktop.

Select an option

Save JeremyLikness/f3d00edcabced5182dacec7cedc57fb1 to your computer and use it in GitHub Desktop.
export class ReduxAdventureAppComponent {
private _store: Store<Dungeon>;
public dungeon: Dungeon;
constructor() {
this._store = createStore(mainReducer);
this.dungeon = this._store.getState();
this._store.subscribe(() => this.dungeon = this._store.getState());
}
title = 'Welcome to the Redux Adventure!';
public handleAction(action: string): void {
this._store.dispatch(createAction(this._store.getState(), action));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment