Imagine a dashboard with a search field, a sales chart and a user profile. You type one character into the search field. The chart has received no new data. The profile hasn't changed. Yet both components appear in your console logs again.
It is tempting to start adding memoisation. But before changing anything, it helps to understand why React called those components in the first place. Sometimes the fix is a single change to where state lives, not another hook.
The examples below assume ordinary client-side React without React Compiler unless explicitly stated. Each example is independent.
1. Your parent component is rendering again
Consider a report editor. Editing its title should not change the report preview's contents.
import { useState } from 'react';
function Preview({ reportId }) {
console.log('Preview rendered');
return <p>Preview for report {reportId}</p>;
}
export default function ReportEditor() {
const [title, setTitle] = useState('Monthly sales');
return (
<section>
<input aria-label="Report title" value={title}
onChange={event => setTitle(event.target.value)} />
<Preview reportId="sales-2026" />
</section>
);
}
Type in the input and the preview function can run again even though reportId is unchanged. Updating state schedules rendering of the component that owns it. Ordinary rendering then proceeds through its children, subject to React's available optimisations.
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="300" viewBox="0 0 760 300" role="img" aria-label="Parent state and child rendering">
<rect width="760" height="300" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="21" fill="#242b25" text-anchor="start">Parent state and child rendering</text>
<rect x="245" y="58" width="270" height="46" rx="7" fill="#e6eadd" stroke="#242b25"/>
<text x="380.0" y="86" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Report editor: state changes</text>
<line x1="380" y1="104" x2="380" y2="123" stroke="#6d7268" stroke-width="1.5"/>
<line x1="185" y1="123" x2="575" y2="123" stroke="#6d7268" stroke-width="1.5"/>
<line x1="185" y1="123" x2="185" y2="145" stroke="#6d7268" stroke-width="1.5"/>
<line x1="575" y1="123" x2="575" y2="145" stroke="#6d7268" stroke-width="1.5"/>
<rect x="65" y="145" width="240" height="46" rx="7" fill="#e6eadd" stroke="#242b25"/>
<text x="185.0" y="173" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Title input renders</text>
<rect x="455" y="145" width="240" height="46" rx="7" fill="#fffef9" stroke="#ab4932"/>
<text x="575.0" y="173" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Preview renders</text>
<text x="185" y="218" font-family="Arial, sans-serif" font-size="14" fill="#242b25" text-anchor="middle">DOM value changes</text>
<text x="575" y="218" font-family="Arial, sans-serif" font-size="14" fill="#242b25" text-anchor="middle">Same props; same output</text>
<text x="575" y="242" font-family="Arial, sans-serif" font-size="13" fill="#6d7268" text-anchor="middle">No preview DOM change required</text>
<text x="380" y="280" font-family="Arial, sans-serif" font-size="14" fill="#6d7268" text-anchor="middle">Rendering and committing DOM changes are different operations.</text>
</svg>A render is React calculating the next UI. A commit is applying the required changes. The browser DOM for the preview may remain untouched even when its component function runs. These are distinct costs: executing component code, reconciling output, updating the DOM and browser layout or painting.
React's Render and Commit guide explains this distinction. A console log alone cannot tell you that a DOM update happened or that an interaction became slower.
A targeted optimisation
import { memo } from 'react';
const Preview = memo(function Preview({ reportId }) {
return <p>Preview for report {reportId}</p>;
});
Now React can usually reuse the preview when its parent renders with the same props. This is useful if the preview contains expensive calculations or a large component tree. For a paragraph like this one, the saving may be negligible.
memo is an optimisation rather than a guarantee, and it does not prevent updates originating from the component's own state or context. See the official memo reference.
2. Your props look unchanged, but their identities aren't
A team adds memo to a slow chart and sees no improvement. The chart's configuration looks identical on every render:
<Chart options={{ currency: 'SGD', precision: 2 }} />
The issue isn't the contents. It's the object itself.
Object.is('SGD', 'SGD'); // true
Object.is({ precision: 2 }, { precision: 2 }); // false
Object.is([1, 2], [1, 2]); // false
Object.is(() => {}, () => {}); // false
React's default memo comparison uses Object.is on each prop. Two separately created objects containing equivalent fields are still distinct objects. The same applies to arrays and functions.
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="280" viewBox="0 0 760 280" role="img" aria-label="Equal contents do not imply equal identity">
<rect width="760" height="280" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="21" fill="#242b25" text-anchor="start">Equal contents do not imply equal identity</text>
<text x="24" y="68" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="start">Primitive props</text>
<rect x="24" y="83" width="290" height="46" rx="7" fill="#e6eadd" stroke="#d9ddd2"/>
<text x="169.0" y="111" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Previous: SGD</text>
<rect x="446" y="83" width="290" height="46" rx="7" fill="#e6eadd" stroke="#d9ddd2"/>
<text x="591.0" y="111" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Next: SGD</text>
<text x="380" y="112" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Equal</text>
<text x="24" y="163" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="start">Object props created during rendering</text>
<rect x="24" y="178" width="290" height="46" rx="7" fill="#fffef9" stroke="#d9ddd2"/>
<text x="169.0" y="206" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Object A: precision = 2</text>
<rect x="446" y="178" width="290" height="46" rx="7" fill="#fffef9" stroke="#d9ddd2"/>
<text x="591.0" y="206" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Object B: precision = 2</text>
<text x="380" y="207" font-family="Arial, sans-serif" font-size="14" fill="#ab4932" text-anchor="middle">Not equal</text>
<text x="380" y="258" font-family="Arial, sans-serif" font-size="14" fill="#6d7268" text-anchor="middle">Default memo comparison checks each prop with Object.is.</text>
</svg>The easiest solution is often to pass fewer values:
<Chart currency="SGD" precision={2} />
If the configuration must be an object, and its identity matters, stabilise it:
import { useMemo } from 'react';
// Inside the parent component:
const options = useMemo(
() => ({ currency, precision }),
[currency, precision]
);
return <Chart options={options} />;
For callbacks, useCallback serves a similar purpose. Suppose a memoised list receives a callback for selecting a product:
const handleSelect = useCallback(id => {
setSelectedId(id);
}, []);
return <ProductList onSelect={handleSelect} />;
Here the state setter is stable and the callback doesn't read changing state. If you later reference other reactive values inside the callback, include them in its dependencies.
Do not omit dependencies merely to preserve an identity. That risks stale closures: the callback can continue using an earlier render's values.
Also, avoid writing custom comparison functions that ignore callback props. Two callbacks with similar source code can capture different state. Deep comparison can cost more than rendering the component itself. Measure it before introducing it.
3. Your component subscribes to more state than you think
Suppose a report editor has a reset button that reads only the reset action from context. Editing the title still causes it to render:
const EditorContext = createContext(null);
function ResetButton() {
const { reset } = useContext(EditorContext);
return <button onClick={reset}>Reset</button>;
}
If the provider supplies { title, setTitle, reset }, every title change produces a different context value. Destructuring only reset doesn't narrow the subscription to that field. Even wrapping ResetButton in memo doesn't block a context update.
Memoising the provider value helps when the parent renders for unrelated reasons, but cannot keep it unchanged when the title genuinely changes.
A better design separates frequently changing state from stable actions:
import { createContext, memo, useContext, useReducer } from 'react';
const EditorState = createContext(null);
const EditorDispatch = createContext(null);
const initialState = { title: 'Monthly sales' };
function reducer(state, action) {
switch (action.type) {
case 'rename': return { ...state, title: action.title };
case 'reset': return initialState;
default: return state;
}
}
export function EditorProvider({ children }) {
const [state, dispatch] = useReducer(reducer, initialState);
return (
<EditorDispatch.Provider value={dispatch}>
<EditorState.Provider value={state}>
{children}
</EditorState.Provider>
</EditorDispatch.Provider>
);
}
function TitleInput() {
const { title } = useContext(EditorState);
const dispatch = useContext(EditorDispatch);
return <input aria-label="Title" value={title}
onChange={e => dispatch({ type: 'rename', title: e.target.value })} />;
}
const ResetButton = memo(function ResetButton() {
const dispatch = useContext(EditorDispatch);
return <button onClick={() => dispatch({ type: 'reset' })}>Reset</button>;
});
export default function App() {
return <EditorProvider><TitleInput /><ResetButton /></EditorProvider>;
}
The dispatch identity is stable, so changing the title does not trigger a dispatch-context update. The reset button is also memoised against ordinary parent-driven rendering.
SVG source
<svg xmlns="http://www.w3.org/2000/svg" width="760" height="270" viewBox="0 0 760 270" role="img" aria-label="Separate state from stable actions">
<rect width="760" height="270" rx="8" fill="#f6f4ee"/>
<text x="24" y="34" font-family="Arial, sans-serif" font-size="21" fill="#242b25" text-anchor="start">Separate state from stable actions</text>
<rect x="24" y="65" width="340" height="46" rx="7" fill="#e6eadd" stroke="#242b25"/>
<text x="194.0" y="93" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Editor state: title changes</text>
<rect x="396" y="65" width="340" height="46" rx="7" fill="#e6eadd" stroke="#242b25"/>
<text x="566.0" y="93" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Dispatch: stable identity</text>
<line x1="194" y1="111" x2="194" y2="165" stroke="#ab4932" stroke-width="1.5"/>
<line x1="566" y1="111" x2="566" y2="165" stroke="#6d7268" stroke-width="1.5"/>
<rect x="24" y="165" width="340" height="46" rx="7" fill="#fffef9" stroke="#ab4932"/>
<text x="194.0" y="193" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Title input: receives new state</text>
<rect x="396" y="165" width="340" height="46" rx="7" fill="#fffef9" stroke="#d9ddd2"/>
<text x="566.0" y="193" font-family="Arial, sans-serif" font-size="15" fill="#242b25" text-anchor="middle">Reset button: no context update</text>
<text x="380" y="246" font-family="Arial, sans-serif" font-size="13" fill="#6d7268" text-anchor="middle">The button can still render for other reasons, including its own state.</text>
</svg>A similar principle applies to external stores: subscribe to the smallest meaningful slice supported by the store's API. A custom hook that reads an entire store and returns one field may still subscribe to the entire store.
4. Moving state can be more effective than memoisation
Return to the report editor. What if only the title input needs the title while the user types? Move the draft into a smaller component:
function TitleEditor({ onSave }) {
const [draft, setDraft] = useState('Monthly sales');
return (
<form onSubmit={e => { e.preventDefault(); onSave(draft); }}>
<input aria-label="Report title" value={draft}
onChange={e => setDraft(e.target.value)} />
<button>Save</button>
</form>
);
}
function ReportEditor({ saveTitle }) {
return (
<section>
<TitleEditor onSave={saveTitle} />
<Preview reportId="sales-2026" />
</section>
);
}
Typing now updates TitleEditor, rather than the entire editor. The preview is a sibling outside that state update's normal render path. No memoisation is required to achieve this isolation.
There is a trade-off: this design changes the behaviour to a local draft with explicit saving. If the preview must display the title live, the shared state belongs at an appropriate common ancestor instead. Never move state purely for performance if doing so breaks the UI's contract.
Composition also helps. A wrapper that manages its own state can receive expensive content through children, allowing React to reuse that content when its parent has not supplied a new element.
function Collapsible({ children }) {
const [open, setOpen] = useState(true);
return <section>
<button onClick={() => setOpen(v => !v)}>Toggle</button>
<div hidden={!open}>{children}</div>
</section>;
}
// Rendered by another component:
<Collapsible><Preview reportId="sales-2026" /></Collapsible>
Using hidden keeps the child mounted, unlike conditionally removing it. That is useful when preserving child state matters, but hidden components can still run effects and consume resources. Choose deliberately.
5. A repeated render log might not mean what you think
React Strict Mode can invoke render logic extra times during development to expose impure components. Concurrent rendering can also begin work that never becomes a committed update. Neither situation implies that the DOM was changed twice.
Another common confusion is remounting. If a component's key or type changes, React can replace its instance rather than update the existing one:
<Editor key={documentId} documentId={documentId} />
Changing documentId here intentionally resets editor state. But a key such as Math.random() would cause replacement on every parent render. Defining a component inside another component's function can similarly create a new component type each time.
A remount can reset state, recreate subscriptions and initiate new requests. memo cannot preserve an instance that React has been asked to replace.
Don't disable Strict Mode simply to reduce console logs. Instead distinguish render attempts, committed updates and mounts when investigating.
6. Measure the cost before adding another hook
Use React DevTools Profiler to record an interaction, such as typing into the report title. Look for components that account for a meaningful share of the rendering time. The built-in Profiler also supports instrumentation:
import { Profiler } from 'react';
function onRender(id, phase, actualDuration, baseDuration) {
console.log({ id, phase, actualDuration, baseDuration });
}
<Profiler id="ReportPreview" onRender={onRender}>
<Preview reportId="sales-2026" />
</Profiler>
actualDuration describes rendering work for a committed update in the profiled subtree. baseDuration estimates the cost of rendering the whole subtree without optimisations, based on recent component timings. Neither is an end-to-end measure of typing latency or a measurement of DOM painting.
Profile comparable interactions before and after a change. Use browser performance tooling to investigate layout, JavaScript tasks and painting when rendering isn't the main bottleneck. Development measurements have overhead; React profiling in production requires a profiling-enabled build.
A component rendering twenty times and taking little time may be less important than a chart rendering once and blocking input. Optimise expensive work, not console counts.
7. What changes with React Compiler?
React Compiler can automatically memoise eligible components and expressions, reducing the need for manual memo, useMemo and useCallback in applications where it is enabled. It isn't automatically active just because an application uses a recent React release. Check your build configuration.
The underlying design decisions still matter. A compiler does not make genuine changes to consumed state disappear, repair impure rendering logic or make unstable keys preserve component instances. Keep state local where appropriate, design sensible subscriptions and follow the Rules of React.
For new code, start with readable components. For existing code, measure before removing deliberate manual optimisations. Consult the React Compiler introduction and official release announcement for its scope.
A practical debugging checklist
| Symptom | First thing to inspect |
|---|---|
| Child renders when a parent input changes | State ownership and parent-driven rendering |
| Memoised child still renders | Object, array and callback prop identity |
| Context consumer renders with unchanged props | Provider value and subscription boundaries |
| Local state changes | Expected update; memo does not block it |
| State resets or effects restart | Component type, keys and remounting |
| Extra development-only logs | Strict Mode and render attempts |
| Typing feels slow | Profiler, browser tasks and actual interaction latency |
Final thoughts
The important question isn't whether React called a component twice. It's whether the work was necessary, how expensive it was, and whether users noticed.
A well-placed state boundary may remove more rendering work than a dozen memoisation hooks. Stable props help when an expensive child can reuse previous output. Narrower subscriptions help when a component is listening to information it never displays.
Start by understanding the dependency that caused the update. Then decide whether it needs optimisation at all.
References and further reading
- React: Render and Commit
- React: memo
- React: useContext
- React: useMemo
- React: useCallback
- React: React Compiler introduction
- React: React Compiler v1.0
- Additional reading: Profiler, StrictMode, Preserving and Resetting State, useReducer.
Related real-world developer discussions
- React memo keeps rendering when props have not changed — Context subscription changes can bypass prop memoisation.
- Why does child component re-render even if useMemo is used? — Distinguishes memoising a value from skipping a child render.
- How React.memo works with useCallback — Demonstrates how fresh callback identities affect memoised children.
These discussions illustrate developer confusion; the official React documentation is the authority for current behaviour.
Editorial information (not part of article)
- SEO slug: why-react-components-re-render-with-unchanged-props
- Category: React / Frontend Performance
- Audience: Intermediate frontend and full-stack developers
- Tags: React, JavaScript, Web Development, Performance, Software Engineering
- Meta description: Learn why React components re-render with unchanged props, how context and reference identity affect memoisation, and when to use React Compiler or state isolation.
- Cover image prompt: Minimal editorial diagram of a React component tree, one terracotta update propagating through neutral nodes, a soft green isolated subtree, warm ivory background, charcoal outlines, restrained accents, landscape 16:9, no text or logos.
- Verification: Core memo, rendering, context, callback and compiler guidance checked against official React documentation. Three Stack Overflow discussions located and checked against search results. Additional reading links supplied for supplementary topics. Examples are original and illustrative; not executed in a React application. No measured performance claims.
Five suggested next articles
- When a Web Worker Is Better Than Another useMemo — Offload expensive synchronous computations.
- Why Your React Component Keeps Losing Its State — Keys, component identity and remounts.
- 7 Browser APIs That Every Frontend Developer Should Know — Useful native browser capabilities.
- Why Your API Needs an Idempotency Key — Safe retries and durable operation identities.
- 5 Database Indexing Mistakes That Can Slow Down Your Application — Query plans and compound indexes.
SVG source assets (not part of article)
Use the indicated figures in the article. Each SVG is standalone and uses the Buildworthy light palette.
parent-render.svg
Caption: A title update can render both children, while the preview DOM remains unchanged.
Alt text: Parent state and child rendering. A title update can render both children, while the preview DOM remains unchanged.
prop-identity.svg
Caption: Primitive values compare equal; independently created objects do not.
Alt text: Value versus reference identity. Primitive values compare equal; independently created objects do not.
context-subscriptions.svg
Caption: A changing title updates the state context, while stable dispatch is shared separately.
Alt text: Splitting state and action subscriptions. A changing title updates the state context, while stable dispatch is shared separately.
THE CONVERSATION
Comments
Questions, useful examples and different approaches are welcome. Keep the discussion thoughtful and on topic.
Loading comments…