Created
May 27, 2021 07:31
-
-
Save narennaik/32fc0d98e024d1ca2614b8f9251ae537 to your computer and use it in GitHub Desktop.
TODO reducer
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 todo = (state, action) => { | |
if (!state) { | |
return []; | |
} else if (action.type === "ADD_TODO") { | |
return [...state, action.payload]; | |
} else { | |
return state; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment