Created
April 7, 2017 09:48
-
-
Save razdvapoka/d08aba38fb169ef322475e19ab23ef05 to your computer and use it in GitHub Desktop.
withFullState (multiple Recompose.withState composed together)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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