Skip to content

Instantly share code, notes, and snippets.

@tonkec
Created March 6, 2019 11:39
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 tonkec/e5b561c2dead989d0dfaed2b851f5ed7 to your computer and use it in GitHub Desktop.
Save tonkec/e5b561c2dead989d0dfaed2b851f5ed7 to your computer and use it in GitHub Desktop.
const incrementCount = ( {incrementBy} = {} ) => {
console.log(incrementBy) // propery on the payload object
/*
payload = {
incrementBy: 5
}
*/
return {
type: 'INCREMENT',
incrementBy: typeof incrementBy === "number" ? incrementBy : 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment