I'm trying to exec a validation like this:
const validateWithState = compose(
withState('current', 'handleChange', {}),
withState('isValid', 'validate', false),
withHandlers({
handleChange: ({current, handleChange, validate}) => () => {
/* logic here */
handleChange(current, () => {
validate() /* <--- here */
})
},
validate: ({current}) => () => {
/* this line is never reached */
}
})
)
For some reason the validate
handler never executed.
Ideas?