Skip to content

Instantly share code, notes, and snippets.

@Waltari10
Created April 26, 2020 12:00
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 Waltari10/14ec08fce46c6771bdecd0999263a8b6 to your computer and use it in GitHub Desktop.
Save Waltari10/14ec08fce46c6771bdecd0999263a8b6 to your computer and use it in GitHub Desktop.
...
const [henchmenState, dispatchHenchmen] = useReducer(henchmenReducer, initialHenchmenState);
...
const handleHenchmanChange = useCallback((henchman, id) => {
// handle modifying henchmen in reducer
dispatchHenchmen({
type: actions.UPDATE,
payload: {
id,
henchman,
},
});
}, [dispatchHenchmen]);
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment