Created
December 27, 2019 14:29
-
-
Save rajat1saxena/3dd6a1498127f803fc4324cf561a62de to your computer and use it in GitHub Desktop.
Super Fast Redux Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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