React Redux Component Lifecycle

const store = createStore(reducer);
const state = store.getState();
{ type: 'ADD_TODO', text: 'Use Redux' }
const initialState = { value: 0 }function counterReducer(state = initialState, action) {  
// Check to see if the reducer cares about this action
if (action.type === 'counter/incremented') {
// If so, make a copy of `state`
return { ...state,
// and update the copy with the new value
value: state.value + 1 } }
// otherwise return the existing state unchanged
return state}

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store