inline literal
An object, array or function written directly in JSX or the component body, which creates a brand-new value on every render.
In more detail
Passing style={{ color: "red" }} or onClick={() => ...} to a memoized child breaks its memoization because the prop is never reference-equal. Move it outside the component, or wrap it in useMemo or useCallback, when that matters.
Related terms
- reference equality — Comparing two references to see whether they point to the very same object, rather than to objects with equal contents.
- React.memo — A React function that wraps a component so it skips re-rendering when its props are shallowly equal to the previous ones.
- useMemo — The React hook that caches the result of a calculation between renders and recalculates only when its dependencies change.
- useCallback — The React hook that returns the same function object between renders until one of its dependencies changes.
Taught in
- useContext in Depth: Scoping, Consumer Subscription Costs — React 19 & Modern Component Architecture
- useSyncExternalStore: Tearing-Free Store Subscriptions — React 19 & Modern Component Architecture
- React.memo, useMemo, And useCallback: Optimization Costs — React 19 & Modern Component Architecture