shallowEqual
functionsignature
shallowEqual<T>(a, b): booleanShallow object equality using Object.is per-key.
Useful as the isEqual argument for useAtomicProp and useAtomicProps
when the derived value is a plain object. Also available from the object
returned by createHooks and createYoltra.
Type parameters
| Name | Type | Description |
|---|---|---|
T | extends Record<string, unknown> |
Parameters
| Name | Type | Description |
|---|---|---|
a | T |
| Name | Type | Description |
|---|---|---|
b | T |
Returns
boolean
Example
example
shallowEqual({ a: 1 }, { a: 1 }); // true
shallowEqual({ a: 1 }, { a: 2 }); // false