next.js 948 B

1234567891011121314151617
  1. // The secondary entry point assumes we are working with React 18, and thus have
  2. // useSyncExternalStore available. We can import that directly from React itself.
  3. // The useSyncExternalStoreWithSelector has to be imported, but we can use the
  4. // non-shim version. This shaves off the byte size of the shim.
  5. import * as React from 'react';
  6. import { useSyncExternalStoreWithSelector } from 'use-sync-external-store/with-selector';
  7. import { unstable_batchedUpdates as batch } from './utils/reactBatchedUpdates';
  8. import { setBatch } from './utils/batch';
  9. import { initializeUseSelector } from './hooks/useSelector';
  10. import { initializeConnect } from './components/connect';
  11. initializeUseSelector(useSyncExternalStoreWithSelector);
  12. initializeConnect(React.useSyncExternalStore); // Enable batched updates in our subscriptions for use
  13. // with standard React renderers (ReactDOM, React Native)
  14. setBatch(batch);
  15. export { batch };
  16. export * from './exports';