// src/App.jsx import { memo, useMemo, useState } from "react"; const ItemList = memo(function ItemList({ items }) { console.log("ItemList rendered"); return ( ); }); function App() { const [count, setCount] = useState(0); const items = useMemo(() => ["Apple", "Banana", "Cherry"], []); return (
); } export default App; /* Notes: - useMemo(() => [...], []) computes the items array exactly once and returns the same array reference on every subsequent render. - Because ItemList is wrapped in memo and its items prop never actually changes reference, clicking the count button no longer logs "ItemList rendered" — confirmed in the browser console. */