We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
onlyUpdateForKeys接收一个数组字符串,只有当指定的props被修改时才更新。这个api不像shouldUpdate 不用自己写比较逻辑,它的内部会自动使用shouldUpdate和shallowEqual进行包装。
onlyUpdateForKeys
props
shouldUpdate
shallowEqual
onlyUpdateForKeys( propKeys: Array<string> ): HigherOrderComponent
const { compose, pure, onlyUpdateForKeys } = Recompose; // 只有当 title props 被更改时才会更新组件(render) const Foo = compose( pure, onlyUpdateForKeys(['title']) , )(({ title }) => ( <div>{console.log('render')}{title}</div> ))
在codepen在线预览
The text was updated successfully, but these errors were encountered:
No branches or pull requests
onlyUpdateForKeys 介绍
onlyUpdateForKeys
接收一个数组字符串,只有当指定的props
被修改时才更新。这个api不像shouldUpdate
不用自己写比较逻辑,它的内部会自动使用shouldUpdate
和shallowEqual
进行包装。onlyUpdateForKeys Flow Type
onlyUpdateForKeys 实例
在线DEMO
在codepen在线预览
The text was updated successfully, but these errors were encountered: