A new challenge every 3 hours. Build a streak. Master tech fundamentals.
Daily Tech Challenge
useMemo is called here WITHOUT a dependency array. This is a production build with no StrictMode. Report mounts, then the user clicks the button three times (rows never changes). How many times is 'summing' logged in total?
function Report({ rows }) {
const total = useMemo(() => {
console.log('summing');
return rows.reduce((sum, r) => sum + r.amount, 0);
});
const [open, setOpen] = useState(false);
return (
<button onClick={() => setOpen(!open)}>
Total: {total} {open ? '-' : '+'}
</button>
);
}Friday, October 9, 2026 · A new challenge drops every day