Skip to content

Instantly share code, notes, and snippets.

@razdvapoka
Created April 7, 2017 09:48
Show Gist options
  • Save razdvapoka/d08aba38fb169ef322475e19ab23ef05 to your computer and use it in GitHub Desktop.
Save razdvapoka/d08aba38fb169ef322475e19ab23ef05 to your computer and use it in GitHub Desktop.
withFullState (multiple Recompose.withState composed together)
const capitalize = string =>
`${string.charAt(0).toUpperCase()}${string.slice(1)}`
const withFullState = stateSpec =>
compose(
...Object
.keys(stateSpec)
.map(stateKey =>
withState(
stateKey,
`set${capitalize(stateKey)}`,
stateSpec[stateKey]
)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment