DEV Community

Cover image for Redux without the sting
Adam Byrne
Adam Byrne

Posted on

Redux without the sting

Redux is a "state management system" (English: creates one layer for data and actions to live)

Once imported you can spin up Redux by creating a store
const store = Redux.createStore(reducer)

A reducer is the brains of the operation. It takes in actions and handles the state.
`const reducer = (state=0, action) => {
/* initialise state as 0 */

switch(action.type) {
case "INCREMENT":
return state + 1;
default:
return state;
}
}`

Top comments (0)