Skip to content

Instantly share code, notes, and snippets.

@neomatrixcode
Created November 1, 2020 01:29
Show Gist options
  • Save neomatrixcode/f8c746a5f2f57981ecbb7f3bf95e9983 to your computer and use it in GitHub Desktop.
Save neomatrixcode/f8c746a5f2f57981ecbb7f3bf95e9983 to your computer and use it in GitHub Desktop.
const tareas = (state = [], action) => {
switch (action.type) {
case 'AGREGAR_TAREA':
return [
...state,
{
id: action.id,
text: action.text
}
]
default:
return state
}
}
function rootReducer(state = {}, action) {
return {
tareas: tareas(state.tareas, action)
};
}
export default rootReducer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment