(this: Component, nextProps)
| 5 | |
| 6 | export function memo (component: Function, propsAreEqual?: Function) { |
| 7 | function shouldComponentUpdate (this: Component, nextProps): boolean { |
| 8 | const prevRef = this.props.ref |
| 9 | const nextRef = nextProps.ref |
| 10 | if (prevRef !== nextRef) { |
| 11 | Ref.detach(this.vnode, prevRef, this.dom) |
| 12 | Ref.attach(this.vnode, nextRef, this.dom) |
| 13 | return true |
| 14 | } |
| 15 | return isFunction(propsAreEqual) ? !propsAreEqual(this.props, nextProps) : !shallowEqual(this.props, nextProps) |
| 16 | } |
| 17 | |
| 18 | function Memoed (this: Component, props) { |
| 19 | this.shouldComponentUpdate = shouldComponentUpdate |
nothing calls this directly
no test coverage detected