Skip to content

Instantly share code, notes, and snippets.

@rubenmarcus
Created April 18, 2020 10:57
Show Gist options
  • Select an option

  • Save rubenmarcus/f6335bd4261e83b41f0c1d625c2c6857 to your computer and use it in GitHub Desktop.

Select an option

Save rubenmarcus/f6335bd4261e83b41f0c1d625c2c6857 to your computer and use it in GitHub Desktop.
const buySandwich = () => {
return dispatch(makeASandwich('Me'))
.then(() => dispatch(makeASandwich('Sis')))
.then(() => dispatch(makeASandwich('Dad')))
.then(() => dispatch(makeASandwich('Dog')))
.then(() =>
dispatch(
getState().myMoney > 42
? withdrawMoney(42)
: apologize('Me', 'The Shop'),
)
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment