Skip to content

Instantly share code, notes, and snippets.

@hendrikswan
Created October 30, 2017 09:31
Show Gist options
  • Save hendrikswan/c70341c221327ea068b3cacd003fe6be to your computer and use it in GitHub Desktop.
Save hendrikswan/c70341c221327ea068b3cacd003fe6be to your computer and use it in GitHub Desktop.
const handleDrawingEvent = line => ({
line,
type: 'LINE_DRAWN'
})
const defaultState = { lines: [] };
const reducer = (state = defaultState, action) => {
switch (action.type) {
case 'LINE_DRAWN':
return { ...state, lines: [...state.lines, action.line] };
default:
return state;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment