Repository navigation
v1.0.19
New compare hook
This release adds a new hook and comparison functions.
Changes
useCompareEffect— added a new hook for running effects with deep, shallow or custom dependency comparison.deepEqual— added a function for deep value comparison.shallowEqual— added a function for shallow value comparison.
Deprecated
useShallowEffect,useDeepEffectanduseCustomCompareEffect— deprecated in favor ofuseCompareEffect.
Migration guide
Replace useShallowEffect with useCompareEffect and pass shallowEqual explicitly. The default comparator of useCompareEffect is deepEqual.
// Before
import { useShallowEffect } from '@siberiacancode/reactuse';
useShallowEffect(effect, [user]);
// After
import { shallowEqual, useCompareEffect } from '@siberiacancode/reactuse';
useCompareEffect(effect, [user], shallowEqual);