shallowEqual
Compare component render counts when a selector returns an object with unchanged values.
shallowEqual in Action
Both selectors return an object with the first and last name. Change an unrelated setting to compare their render counts.
Without shallowEqualrenders: 1
Alice Smith
Re-renders on every store change
With shallowEqualrenders: 1
Alice Smith
Only re-renders when name values change
Full Store Staterenders: 1
firstName:AlicelastName:Smithage:30theme:darknotifications:true
Change name (both cards should re-render)
Change unrelated state (only "without" card should re-render)
API · shallowEqual<T>(a: T, b: T): boolean from @codebelt/classy-store.
Use the isEqual option when a selector builds a new object or array. For a getter that returns an object, check its snapshot identity before choosing an equality function.
