Smart Scheduling

Spaced repetition

Back to React Hooks

Cards

8 cards in React Hooks

Select all

What does useReducer do?

An alternative to useState for complex state logic, accepts a reducer function and initial state

Due
Created Jan 7, 2026Ease: 2.85Interval: 13 days

What is the purpose of useCallback?

Returns a memoized callback function that only changes when dependencies change

Due
Created Jan 7, 2026Ease: 2.47Interval: 3 days

When should you use useMemo?

To memoize expensive calculations that only need to recompute when dependencies change

Due
Created Jan 7, 2026Ease: 2.50Interval: 6 days

What does useRef return?

A mutable ref object with a .current property that persists across renders

Due
Created Jan 7, 2026Ease: 2.50Interval: 0 days

What is useContext used for?

Subscribing to React context without wrapping components in Consumer

Due
Created Jan 7, 2026Ease: 3.00Interval: 11 days

How do you run useEffect only once on mount?

Pass an empty dependency array: useEffect(() => {}, [])

Due
Created Jan 7, 2026Ease: 2.52Interval: 3 days

When does useEffect run by default?

After every render (initial render and updates)

Due
Created Jan 7, 2026Ease: 2.50Interval: 1 days

What does useState return?

An array with two elements: the current state value and a function to update it

Due
Created Jan 7, 2026Ease: 2.50Interval: 0 days