Home / File/ useSyncExternalStore.js — react Source File

useSyncExternalStore.js — react Source File

Architecture documentation for useSyncExternalStore.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript 1 imports

Entity Profile

Dependency Diagram

graph LR
  e6bb792f_eaba_8d8b_0c0c_a7a436c96fe3["useSyncExternalStore.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  e6bb792f_eaba_8d8b_0c0c_a7a436c96fe3 --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  style e6bb792f_eaba_8d8b_0c0c_a7a436c96fe3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 * @flow
 */

'use strict';

// Intentionally not using named imports because Rollup uses dynamic
// dispatch for CommonJS interop named imports.
import * as React from 'react';

export const useSyncExternalStore = React.useSyncExternalStore;

if (__DEV__) {
  // Avoid transforming the `console.error` call as it would cause the built artifact
  // to access React internals, which exist under different paths depending on the
  // React version.
  console['error'](
    "The main 'use-sync-external-store' entry point is not supported; all it " +
      "does is re-export useSyncExternalStore from the 'react' package, so " +
      'it only works with React 18+.' +
      '\n\n' +
      'If you wish to support React 16 and 17, import from ' +
      "'use-sync-external-store/shim' instead. It will fall back to a shimmed " +
      'implementation when the native one is not available.' +
      '\n\n' +
      "If you only support React 18+, you can import directly from 'react'.",
  );
}

Dependencies

  • react

Frequently Asked Questions

What does useSyncExternalStore.js do?
useSyncExternalStore.js is a source file in the react codebase, written in javascript.
What does useSyncExternalStore.js depend on?
useSyncExternalStore.js imports 1 module(s): react.
Where is useSyncExternalStore.js in the architecture?
useSyncExternalStore.js is located at packages/use-sync-external-store/src/useSyncExternalStore.js (directory: packages/use-sync-external-store/src).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free