tezvyn:

Explain the difference between useMemo and useCallback

Source: react.devintermediate

This tests whether useMemo caches values while useCallback caches functions, and why that matters for React.memo. A strong answer notes React.memo uses Object.is, so a new inline function prop triggers a child re-render. Red flag: claiming they are the same.

This tests whether you know useMemo caches a computed value while useCallback caches a function reference, and why referential equality matters for React.memo. A strong answer first defines the distinction: useMemo caches a result, while useCallback caches the function itself. It then explains that React.memo uses Object.is, so a new inline function prop on every parent render forces the child to re-render. A red flag is claiming the hooks are interchangeable or only useful in useEffect dependencies.

Read the original → react.dev

Get five bites like this every day.

Tezvyn delivers a daily feed of 60-second tech bites with quizzes to lock in what you learn.

Explain the difference between useMemo and useCallback · Tezvyn