Created
February 9, 2024 04:22
-
-
Save LoganBarnett/f4438ca3d11f31654907024d43bb4200 to your computer and use it in GitHub Desktop.
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 muhReducer = (state, action) => { | |
switch(action.type) { | |
case 'FROBNICATE': | |
return { | |
frobnicateCount: state.frobnicateCount + 1, | |
...state, | |
} | |
default: | |
return state | |
} | |
} | |
// A button | |
<MuhButton onClick={e => dispatch({ type: 'FROBNICATE' }) } >Frobnicate</MuhButton> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A nested reducer: