16 lines
No EOL
582 B
JavaScript
16 lines
No EOL
582 B
JavaScript
function Component(props) {
|
|
// a does not need to be memoized ever, even though it's a
|
|
// dependency of c, which exists in a scope that has a memoized
|
|
// output. it doesn't need to be memoized bc the value is a primitive type.
|
|
const a = props.a + props.b;
|
|
|
|
// b and c are interleaved and grouped into a single scope,
|
|
// but they are independent values. c does not escape, but
|
|
// we need to ensure that a is memoized or else b will invalidate
|
|
// on every render since a is a dependency.
|
|
const b = [];
|
|
const c = {};
|
|
c.a = a;
|
|
props.c |> b.push(%);
|
|
return b;
|
|
} |