nieyao
nieyao
 这里岂不是违反了hooks的规则,在条件语句中使用了hooks,导致hooks的顺序错乱?
 在条件语句中使用可能会使hooks的调用顺序发生改变
const compose = (...fns) => (...params) => fns.reduce((prev, current) => current(prev), ...params);
> @nieyao params 应该置后,测试示例时没有通过 确实,忘了compose是从右往左执行的,那加个reverse 好了。 const compose = (...fns) => (...params) => fns.reverse().reduce((prev, current) => current(prev), ...params) 或者用reduceRight const compose = (...fns) => (...params) => fns.reduceRight((prev, current) => current(prev),...