File tree Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Expand file tree Collapse file tree 2 files changed +15
-1
lines changed Original file line number Diff line number Diff line change 4949 }
5050 },
5151 "peerDependencies" : {
52- "react" : " ^16.8.0 || ^17.0.0"
52+ "react" : " ^16.8.0 || ^17.0.0 || ^18.0.0 "
5353 },
5454 "devDependencies" : {
5555 "@ampproject/rollup-plugin-closure-compiler" : " ^0.26.0" ,
Original file line number Diff line number Diff line change @@ -320,8 +320,22 @@ function useDeferredValue<T>(input: T): T {
320320 return input
321321}
322322
323+ // See: https://github.com/facebook/react/blob/fe41934/packages/use-sync-external-store/src/useSyncExternalStoreShimServer.js#L10-L20
324+ function useSyncExternalStore< T > (
325+ subscribe: (() => void ) => ( ) => void ,
326+ getSnapshot : ( ) => T ,
327+ getServerSnapshot ?: ( ) => T
328+ ) : T {
329+ // Note: The shim does not use getServerSnapshot, because pre-18 versions of
330+ // React do not expose a way to check if we're hydrating. So users of the shim
331+ // will need to track that themselves and return the correct value
332+ // from `getSnapshot`.
333+ return getSnapshot ( )
334+ }
335+
323336export const Dispatcher = {
324337 readContext ,
338+ useSyncExternalStore ,
325339 useContext ,
326340 useMemo ,
327341 useReducer ,
You can’t perform that action at this time.
0 commit comments