Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
2017/06/06 [Medium] Use Selectors in Redux for Great Good
const initialState = {
todos: []
}
const reducer = (state = initialState, action = {}) => {
if (action.type === 'ADD_TODO') {
return {
...state,
todos: [...state.todos, action.payload]
}
}
return state
}
const allTodos = (state) => state.todos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.