Open monsterooo opened 6 years ago
shouldUpdate是React shouldUpdate的高阶函数包装,用法同https://reactjs.org/docs/react-component.html#shouldcomponentupdate一样。
shouldUpdate
React shouldUpdate
shouldUpdate( test: (props: Object, nextProps: Object) => boolean ): HigherOrderComponent
const Foo = compose( pure, shouldUpdate((props, nextProps) => props.title !== nextProps.title) , )(({ title }) => ( <div>{console.log('render')}{title}</div> ))
在codepen在线预览
shouldUpdate 介绍
shouldUpdate
是React shouldUpdate
的高阶函数包装,用法同https://reactjs.org/docs/react-component.html#shouldcomponentupdate一样。shouldUpdate Flow Type
shouldUpdate 例子
在线DEMO
在codepen在线预览