WA-238 Create openHoc component using withStateHandlers

This commit is contained in:
apanizo 2018-04-26 15:11:03 +02:00
parent 9904e1b12e
commit b7d4944b01
1 changed files with 12 additions and 0 deletions

View File

@ -0,0 +1,12 @@
// @flow
import { withStateHandlers } from 'recompose'
export type Open = {
open: boolean,
toggle: () => void,
}
export default withStateHandlers(
() => ({ open: false }),
{ toggle: ({ open }) => () => ({ open: !open }) },
)