salsita / spicy-hooks

7 stars 0 forks source link

Use `Object.is` as the default equality function of `usePartialSnapshot` #25

Closed goce-cz closed 3 years ago

goce-cz commented 3 years ago

Resolves #14

As agreed by everyone, we're changing the default equality function of usePartialSnapshot from isShallowEqual to Object.is

Migration

You can blindly change every usage of

usePartialSnapshot(observable, selector, [...deps])

into

import { isShallowEqual } from '@spicy-hooks/utils'

...

usePartialSnapshot(observable, selector, isShallowEqual, [...deps])

BUT, please think first whether you really need shallow comparison instead of the default (and much faster) Object.is.