react/packages/use-sync-external-store
OGURA Daiki 4de99b3ca6
fix getSnapshot warning when a selector returns NaN (#23333)
* fix getSnapshot warning when a selector returns NaN

useSyncExternalStoreWithSelector delegate a selector as
getSnapshot of useSyncExternalStore.

* Fiber's use sync external store has a same issue

* Small nits

We use Object.is to check whether the snapshot value has been updated,
so we should also use it to check whether the value is cached.

Co-authored-by: Andrew Clark <git@andrewclark.io>
2022-02-21 01:07:41 -05:00
..
npm Upgrade useSyncExternalStore to alpha channel (#22662) 2021-10-31 15:38:03 -07:00
shim Upgrade useSyncExternalStore to alpha channel (#22662) 2021-10-31 15:38:03 -07:00
src fix getSnapshot warning when a selector returns NaN (#23333) 2022-02-21 01:07:41 -05:00
README.md Set up use-sync-external-store package (#22202) 2021-08-28 13:57:47 -07:00
index.js Upgrade useSyncExternalStore to alpha channel (#22662) 2021-10-31 15:38:03 -07:00
package.json Update the exports field (#23257) 2022-02-08 21:07:26 -05:00
with-selector.js Upgrade useSyncExternalStore to alpha channel (#22662) 2021-10-31 15:38:03 -07:00

README.md

use-sync-external-store

Backwards compatible shim for React's useSyncExternalStore. Works with any React that supports hooks.

Until useSyncExternalStore is documented, refer to https://github.com/reactwg/react-18/discussions/86