Skip to content

Instantly share code, notes, and snippets.

@StevenMDixon
Created October 8, 2018 21:18
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 StevenMDixon/81005b22f9b58e6ea1bdac2726fd1537 to your computer and use it in GitHub Desktop.
Save StevenMDixon/81005b22f9b58e6ea1bdac2726fd1537 to your computer and use it in GitHub Desktop.
store = Redux.createStore(reducer, initialstate, enhancer);
manages what the state lookslike. centralized location for state.
function rootReducer(state= initialState, action){
return state
}
var initialState = {
count: 0
}
store{
dispatch() changes the state. has to have an action object with a type key
getState() returns the current state
}
steps:
create a reducer
create a store
get state with store.getstate
to change dispatch an action that is an object with a key of type
write a function that returns an object or an action, hey factory functions!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment