Last active
February 5, 2018 06:31
-
-
Save eddyw/d09327e729d7e1eba291c089e835cab8 to your computer and use it in GitHub Desktop.
Type-checking Redux State with propTypes (without React)
This file contains hidden or 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
let id = 0 | |
const TodoReducer = (state = [], action) => { | |
switch (action.type) { | |
case 'ADD_TODO': | |
return [...state, { | |
id: ++id, | |
title: action.payload.title, | |
done: action.payload.done, | |
}] | |
default: | |
return state | |
} | |
} | |
export default TodoReducer |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment