ReactBaseClasses.js — react Source File
Architecture documentation for ReactBaseClasses.js, a javascript file in the react codebase. 2 imports, 1 dependents.
Entity Profile
Dependency Diagram
graph LR c3fac770_4990_9966_5876_7fc6a70a6f7d["ReactBaseClasses.js"] 0380df47_462c_01ca_94d0_5147d41c9c3f["ReactNoopUpdateQueue.js"] c3fac770_4990_9966_5876_7fc6a70a6f7d --> 0380df47_462c_01ca_94d0_5147d41c9c3f 326b1b33_c1be_450b_f53b_51a78bbe8633["assign"] c3fac770_4990_9966_5876_7fc6a70a6f7d --> 326b1b33_c1be_450b_f53b_51a78bbe8633 ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5["ReactClient.js"] ffdf54f0_7e34_f1e9_1504_9dbadb0fbac5 --> c3fac770_4990_9966_5876_7fc6a70a6f7d style c3fac770_4990_9966_5876_7fc6a70a6f7d 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.
*/
import ReactNoopUpdateQueue from './ReactNoopUpdateQueue';
import assign from 'shared/assign';
const emptyObject = {};
if (__DEV__) {
Object.freeze(emptyObject);
}
/**
* Base class helpers for the updating state of a component.
*/
function Component(props, context, updater) {
this.props = props;
this.context = context;
// If a component has string refs, we will assign a different object later.
this.refs = emptyObject;
// We initialize the default updater but the real one gets injected by the
// renderer.
this.updater = updater || ReactNoopUpdateQueue;
}
Component.prototype.isReactComponent = {};
/**
* Sets a subset of the state. Always use this to mutate
* state. You should treat `this.state` as immutable.
*
* There is no guarantee that `this.state` will be immediately updated, so
* accessing `this.state` after calling this method may return the old value.
*
* There is no guarantee that calls to `setState` will run synchronously,
* as they may eventually be batched together. You can provide an optional
* callback that will be executed when the call to setState is actually
* completed.
*
* When a function is provided to setState, it will be called at some point in
* the future (not synchronously). It will be called with the up to date
* component arguments (state, props, context). These values can be different
* from this.* because your function may be called after receiveProps but before
* shouldComponentUpdate, and this new state, props, and context will not yet be
* assigned to this.
*
* @param {object|function} partialState Next partial state or function to
* produce next partial state to be merged with current state.
* @param {?function} callback Called after state is updated.
* @final
* @protected
*/
Component.prototype.setState = function (partialState, callback) {
if (
typeof partialState !== 'object' &&
typeof partialState !== 'function' &&
partialState != null
// ... (87 more lines)
Domain
Subdomains
Functions
Dependencies
- ReactNoopUpdateQueue.js
- assign
Imported By
Source
Frequently Asked Questions
What does ReactBaseClasses.js do?
ReactBaseClasses.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 ReactBaseClasses.js?
ReactBaseClasses.js defines 6 function(s): Component, ComponentDummy, PureComponent, defineDeprecationWarning, forceUpdate, setState.
What does ReactBaseClasses.js depend on?
ReactBaseClasses.js imports 2 module(s): ReactNoopUpdateQueue.js, assign.
What files import ReactBaseClasses.js?
ReactBaseClasses.js is imported by 1 file(s): ReactClient.js.
Where is ReactBaseClasses.js in the architecture?
ReactBaseClasses.js is located at packages/react/src/ReactBaseClasses.js (domain: BabelCompiler, subdomain: Validation, directory: packages/react/src).
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free