Control useMemo recalculation
Memoizing an expensive calculation
React 19+ · Type Alias
DependencyList is the fixed-length array of reactive values used by React hooks such as useMemo, useEffect, and useCallback. React compares each entry with its previous value using Object.is to decide whether dependent work should run again.
React uses a dependency list to determine whether a hook's calculation or Effect should run again. It must contain every reactive value referenced by the hook code, have a constant number of items, be written inline, and is compared with the previous list using Object.is.
type DependencyList = readonly unknown[]| Name | Type | Description |
|---|---|---|
dependencies | DependencyList | The fixed-length array of every reactive value referenced by the hook's calculation or setup code. |
A dependency list is an input array used by React hooks to determine whether work should be repeated; DependencyList itself has no runtime return value.
import { useMemo } from 'react';
type DependencyList = readonly unknown[];
export default function Total({ items }: { items: number[] }) {
const total = useMemo(
() => items.reduce((sum, item) => sum + item, 0),
[items]
);
return <output>{total}</output>;
}A dependency list is an inline, fixed-length array containing every reactive value used by the calculation.
Memoizing an expensive calculation
Synchronizing with an external system
Caching a callback
useEffectuseMemouseCallbackexhaustive-deps