A settings panel has a search input and a separate theme display that should stay unchanged when only the search query updates.
Type anything in the search box - the render counter climbs on every keystroke even though the theme never changed.
Think about what React.memo actually compares when it decides whether to skip a re-render.
Think about what React.memo actually compares when it decides whether to skip a re-render.
Why this fixes it
`const config = { theme: "dark" }` runs inside the component body on every render, creating a brand-new object at a new memory address each time. React.memo compares props by reference - `{} !== {}` even when contents are identical - so the new reference caused the memo check to fail on every parent render. Wrapping the object in `useMemo(() => ({ theme: "dark" }), [])` produces the same reference across renders. React.memo now sees the same object and the child skips re-rendering.