Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Redux Reducer
const reducer = (state = '', action) => {
switch (action.type) {
case 'CHARACTER_TYPED':
const { character } = action;
return state + character;
case 'BACKSPACE':
return state.substr(0, state.length - 1);
default:
return state;
}
}
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.