Skip to content

Instantly share code, notes, and snippets.

@komkanit
Last active July 1, 2017 18:37
Show Gist options
  • Save komkanit/b28475873ef3ca67a229c83a6d221d57 to your computer and use it in GitHub Desktop.
Save komkanit/b28475873ef3ca67a229c83a6d221d57 to your computer and use it in GitHub Desktop.
import { compose, withState, withHandlers } from recompose
const enhance = compose(
withState('count', 'setCounter', 0),
withHandlers({
increase: ({ setCounter }) => () => setCounter(n => n + 1),
decrease: ({ setCounter }) => () => setCounter(n => n - 1),
})
)
export default enhance(Component);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment