Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumReactuseCallbackSingle-choice MCQ

A child is wrapped in React.memo and receives `onSelect` from a parent. The parent wraps `onSelect` in useCallback with deps `[selectedId]`, where `selectedId` changes on nearly every interaction. The team is surprised the memo 'does not work'. What is the accurate assessment?

const onSelect = useCallback((id) => { if (id !== selectedId) doSelect(id); }, [selectedId]); // <MemoChild onSelect={onSelect} />