Skip to content

Instantly share code, notes, and snippets.

@sammdec
Created April 20, 2018 15:23
Show Gist options
  • Save sammdec/1a933ee0724b12a0aad00d2a5c3d126e to your computer and use it in GitHub Desktop.
Save sammdec/1a933ee0724b12a0aad00d2a5c3d126e to your computer and use it in GitHub Desktop.
const handleSelectUpdate = (target) => {
return { [target.name]: target.value };
};
handleChosenCountry: (state, target) =>
const selectState = handleSelectUpdate(target);
const newState = handleChosenCountry(state, target.value)
handleFetchEvents({ ...state, chosenCountry: selectState.country }).then(res => {
store.setState({
...state,
...newState,
events: res.data,
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment