Closed albertogasparin closed 2 years ago
With React 18 there is a new useSyncExternalStore hook (and a shim for >= 16.8) to properly subscribe to values in stores.
useSyncExternalStore
https://github.com/reactwg/react-18/discussions/86
Other projects like react-redux are moving to it (PR https://github.com/reduxjs/react-redux/pull/1808 ) so might provide some benefits / need for custom subscription/memoization/scheduling.
react-redux
With React 18 there is a new
useSyncExternalStore
hook (and a shim for >= 16.8) to properly subscribe to values in stores.https://github.com/reactwg/react-18/discussions/86
Other projects like
react-redux
are moving to it (PR https://github.com/reduxjs/react-redux/pull/1808 ) so might provide some benefits / need for custom subscription/memoization/scheduling.