我正在尝试执行这样的验证:
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 */
}
})
)
由于某种原因,validate
处理程序从未执行。
想法?