Zustand 5.x

useShallow

Stabilizes a selector result when its shallow contents are equivalent.

Formal Syntax & Structure

react syntaxreact
useStore(store, useShallow(s => ({density:s.density})))

Working Example

Example Snippetreact
useStore(store, useShallow(s => ({density:s.density})))
React Reference