Skip to content

Instantly share code, notes, and snippets.

@btg5679
Last active July 14, 2017 20:00
Show Gist options
  • Save btg5679/ccec2bf761cf851a24e041f1ff830719 to your computer and use it in GitHub Desktop.
Save btg5679/ccec2bf761cf851a24e041f1ff830719 to your computer and use it in GitHub Desktop.
ReduxIntro2
import { createStore } from 'redux';
// Store
const dataStore = createStore(r, {
beerlist: {
name: 'IPA',
abv: 7.4
},
beersOnTap: 1,
liveMusicHistory: {
bandName: 'Bahamas',
gigDate: '2017-01-01'
},
...
});
// Actions dispatched to your Store
dataStore.dispatch({ type: 'CHANGE_BEER_NAME', payload: 'Stout' });
dataStore.dispatch({ type: 'CHANGE_BEER_ABV', payload: 5.9 });
// Called any time an action is dispatched
dataStore.subscribe(());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment