const withLoading = Component => ({ isLoading, ...rest }) => isLoading ? <Loading /> : <Component { ...rest } />const ButtonWithLoading = withLoading(Button)render里:<ButtonWithLoading isLoading={false}> More</ButtonWithLoading>结果:页面展示效果正常 但tools里有异常 详见下图
1 回答
PIPIONE
TA贡献1829条经验 获得超9个赞
你返回的是个匿名Stateless Component
试一下
const withLoading = Component => function CustomComp({ isLoading, ...rest }) {
return isLoading ? <Loading /> : <Component { ...rest } />
}
添加回答
举报
0/150
提交
取消