Home / Function/ readRecord() — react Function Reference

readRecord() — react Function Reference

Architecture documentation for the readRecord() function in index.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  92952112_95e3_1198_881d_9033798ca772["readRecord()"]
  a48cc242_4b50_fd09_0e8c_65edf69b7004["index.js"]
  92952112_95e3_1198_881d_9033798ca772 -->|defined in| a48cc242_4b50_fd09_0e8c_65edf69b7004
  8d61cf7f_1838_e378_287e_c31c8c79b8cc["Never()"]
  8d61cf7f_1838_e378_287e_c31c8c79b8cc -->|calls| 92952112_95e3_1198_881d_9033798ca772
  style 92952112_95e3_1198_881d_9033798ca772 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-devtools-shell/src/app/SuspenseTree/index.js lines 315–341

function readRecord(promise: any): any {
  if (typeof React.use === 'function') {
    // eslint-disable-next-line react-hooks-published/rules-of-hooks
    return React.use(promise);
  }
  switch (promise.status) {
    case 'pending':
      throw promise;
    case 'rejected':
      throw promise.reason;
    case 'fulfilled':
      return promise.value;
    default:
      promise.status = 'pending';
      promise.then(
        value => {
          promise.status = 'fulfilled';
          promise.value = value;
        },
        reason => {
          promise.status = 'rejected';
          promise.reason = reason;
        },
      );
      throw promise;
  }
}

Domain

Subdomains

Called By

Frequently Asked Questions

What does readRecord() do?
readRecord() is a function in the react codebase, defined in packages/react-devtools-shell/src/app/SuspenseTree/index.js.
Where is readRecord() defined?
readRecord() is defined in packages/react-devtools-shell/src/app/SuspenseTree/index.js at line 315.
What calls readRecord()?
readRecord() is called by 1 function(s): Never.

Analyze Your Own Codebase

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

Try Supermodel Free