Skip to content

Instantly share code, notes, and snippets.

@eddyw
Last active February 5, 2018 06:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyw/d09327e729d7e1eba291c089e835cab8 to your computer and use it in GitHub Desktop.
Save eddyw/d09327e729d7e1eba291c089e835cab8 to your computer and use it in GitHub Desktop.
Type-checking Redux State with propTypes (without React)
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