Home / File/ ReactFiberHostContext.js — react Source File

ReactFiberHostContext.js — react Source File

Architecture documentation for ReactFiberHostContext.js, a javascript file in the react codebase. 4 imports, 6 dependents.

File javascript BabelCompiler Validation 4 imports 6 dependents 6 functions

Entity Profile

Dependency Diagram

graph LR
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0["ReactFiberHostContext.js"]
  6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f["ReactInternalTypes.js"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 --> 6b9f5caa_fb13_3d3c_2f60_ad3c4f58371f
  8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4["ReactFiberStack.js"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 --> 8f731ef5_fa4f_fcf5_0d94_a73afa35b6a4
  a6668d1d_397d_7807_719d_fdecf552fa4a["ReactFiberConfig.js"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 --> a6668d1d_397d_7807_719d_fdecf552fa4a
  85d2c68c_7609_2c66_22fb_5f02e8a2e8fe["ReactFiberHooks.js"]
  0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 --> 85d2c68c_7609_2c66_22fb_5f02e8a2e8fe
  8a03468f_f6e2_d5a3_fdef_e77ebca449c2["ReactFiber.js"]
  8a03468f_f6e2_d5a3_fdef_e77ebca449c2 --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  0be70812_cc0c_b210_f84f_8e61dd5f831c["ReactFiberBeginWork.js"]
  0be70812_cc0c_b210_f84f_8e61dd5f831c --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  6b05669d_2f09_63a5_e79f_0afc195f25a3["ReactFiberCompleteWork.js"]
  6b05669d_2f09_63a5_e79f_0afc195f25a3 --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  4bc7109f_638d_d9f7_bf47_6ec55b2fa128["ReactFiberHydrationContext.js"]
  4bc7109f_638d_d9f7_bf47_6ec55b2fa128 --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  278c890a_abdf_e007_0c26_ae3bc8eda908["ReactFiberNewContext.js"]
  278c890a_abdf_e007_0c26_ae3bc8eda908 --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f["ReactFiberUnwindWork.js"]
  53e7e9e3_9e8c_648e_1f4e_0fdfa5c5cb8f --> 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0
  style 0d0aab7d_e6b3_4636_e6ae_2ed95f8e42d0 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
 */

import type {Fiber} from './ReactInternalTypes';
import type {StackCursor} from './ReactFiberStack';
import type {
  Container,
  HostContext,
  TransitionStatus,
} from './ReactFiberConfig';
import type {Hook} from './ReactFiberHooks';

import {
  getChildHostContext,
  getRootHostContext,
  HostTransitionContext,
  NotPendingTransition,
  isPrimaryRenderer,
} from './ReactFiberConfig';
import {createCursor, push, pop} from './ReactFiberStack';

const contextStackCursor: StackCursor<HostContext | null> = createCursor(null);
const contextFiberStackCursor: StackCursor<Fiber | null> = createCursor(null);
const rootInstanceStackCursor: StackCursor<Container | null> =
  createCursor(null);

// Represents the nearest host transition provider (in React DOM, a <form />)
// NOTE: Since forms cannot be nested, and this feature is only implemented by
// React DOM, we don't technically need this to be a stack. It could be a single
// module variable instead.
const hostTransitionProviderCursor: StackCursor<Fiber | null> =
  createCursor(null);

function requiredContext<Value>(c: Value | null): Value {
  if (__DEV__) {
    if (c === null) {
      console.error(
        'Expected host context to exist. This error is likely caused by a bug ' +
          'in React. Please file an issue.',
      );
    }
  }
  return (c: any);
}

function getCurrentRootHostContainer(): null | Container {
  return rootInstanceStackCursor.current;
}

function getRootHostContainer(): Container {
  const rootInstance = requiredContext(rootInstanceStackCursor.current);
  return rootInstance;
}

// ... (109 more lines)

Domain

Subdomains

Frequently Asked Questions

What does ReactFiberHostContext.js do?
ReactFiberHostContext.js is a source file in the react codebase, written in javascript. It belongs to the BabelCompiler domain, Validation subdomain.
What functions are defined in ReactFiberHostContext.js?
ReactFiberHostContext.js defines 6 function(s): getHostContext, getRootHostContainer, popHostContainer, popHostContext, pushHostContainer, pushHostContext.
What does ReactFiberHostContext.js depend on?
ReactFiberHostContext.js imports 4 module(s): ReactFiberConfig.js, ReactFiberHooks.js, ReactFiberStack.js, ReactInternalTypes.js.
What files import ReactFiberHostContext.js?
ReactFiberHostContext.js is imported by 6 file(s): ReactFiber.js, ReactFiberBeginWork.js, ReactFiberCompleteWork.js, ReactFiberHydrationContext.js, ReactFiberNewContext.js, ReactFiberUnwindWork.js.
Where is ReactFiberHostContext.js in the architecture?
ReactFiberHostContext.js is located at packages/react-reconciler/src/ReactFiberHostContext.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react-reconciler/src).

Analyze Your Own Codebase

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

Try Supermodel Free