MCPcopy
hub / github.com/preactjs/preact / shouldUpdate

Function shouldUpdate

compat/src/memo.js:12–21  ·  view source on GitHub ↗
(nextProps)

Source from the content-addressed store, hash-verified

10 */
11export function memo(c, comparer) {
12 function shouldUpdate(nextProps) {
13 let ref = this.props.ref;
14 if (ref != nextProps.ref && ref) {
15 typeof ref == 'function' ? ref(null) : (ref.current = null);
16 }
17
18 return comparer
19 ? !comparer(this.props, nextProps) || ref != nextProps.ref
20 : shallowDiffers(this.props, nextProps);
21 }
22
23 function Memoed(props) {
24 this.shouldComponentUpdate = shouldUpdate;

Callers

nothing calls this directly

Calls 2

shallowDiffersFunction · 0.90
refFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…