Skip to content

Instantly share code, notes, and snippets.

@rajat1saxena
Created December 27, 2019 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rajat1saxena/3dd6a1498127f803fc4324cf561a62de to your computer and use it in GitHub Desktop.
Save rajat1saxena/3dd6a1498127f803fc4324cf561a62de to your computer and use it in GitHub Desktop.
Super Fast Redux Tutorial
const redux = require('redux')
const store = redux.createStore((state = {}, action) => {
switch (action.type) {
case 'demo':
return { demo: true }
default:
return state
}
})
// listen to store changes
store.subscribe(() => { console.log(store.getState()) })
// let's dispatch an action
store.dispatch({ type: 'demo', data: {a: 2}})
// let's execute :)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment