WA-238 Create openHoc component using withStateHandlers
This commit is contained in:
parent
9904e1b12e
commit
b7d4944b01
|
@ -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 }) },
|
||||||
|
)
|
Loading…
Reference in New Issue