Skip to content
masterclass Buddy

Zustand · Concept

Prevent rerenders with useShallow

useShallow helps prevent unnecessary React rerenders when a selector returns a new object or array whose first-level values are unchanged. It compares the computed result shallowly instead of relying only on Object.is.

Last updated

Syntax

useStore(useShallow((state) => computedValue))

In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.

Subscribe
  • create
  • selector
  • Object.is
  • zustand/react/shallow
  • shallow comparison

Source: Prevent rerenders with useShallow - Zustand Docs. Checked 2026-11-03.