Home / Function/ applyDerivedStateFromProps() — react Function Reference

applyDerivedStateFromProps() — react Function Reference

Architecture documentation for the applyDerivedStateFromProps() function in ReactFizzClassComponent.js from the react codebase.

Entity Profile

Dependency Diagram

graph TD
  6749ca7d_7c02_a31f_a37b_23a73ecf80be["applyDerivedStateFromProps()"]
  8f850c79_0562_f37f_80ff_563c50cd0996["ReactFizzClassComponent.js"]
  6749ca7d_7c02_a31f_a37b_23a73ecf80be -->|defined in| 8f850c79_0562_f37f_80ff_563c50cd0996
  214e29b1_8411_c0df_65fc_dabe157ff86e["mountClassInstance()"]
  214e29b1_8411_c0df_65fc_dabe157ff86e -->|calls| 6749ca7d_7c02_a31f_a37b_23a73ecf80be
  43370118_3c18_f52d_e703_4f0bb5ce0b16["warnOnUndefinedDerivedState()"]
  6749ca7d_7c02_a31f_a37b_23a73ecf80be -->|calls| 43370118_3c18_f52d_e703_4f0bb5ce0b16
  style 6749ca7d_7c02_a31f_a37b_23a73ecf80be fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-server/src/ReactFizzClassComponent.js lines 150–168

function applyDerivedStateFromProps(
  instance: any,
  ctor: any,
  getDerivedStateFromProps: (props: any, state: any) => any,
  prevState: any,
  nextProps: any,
) {
  const partialState = getDerivedStateFromProps(nextProps, prevState);

  if (__DEV__) {
    warnOnUndefinedDerivedState(ctor, partialState);
  }
  // Merge the partial state and the previous state.
  const newState =
    partialState === null || partialState === undefined
      ? prevState
      : assign({}, prevState, partialState);
  return newState;
}

Domain

Subdomains

Frequently Asked Questions

What does applyDerivedStateFromProps() do?
applyDerivedStateFromProps() is a function in the react codebase, defined in packages/react-server/src/ReactFizzClassComponent.js.
Where is applyDerivedStateFromProps() defined?
applyDerivedStateFromProps() is defined in packages/react-server/src/ReactFizzClassComponent.js at line 150.
What does applyDerivedStateFromProps() call?
applyDerivedStateFromProps() calls 1 function(s): warnOnUndefinedDerivedState.
What calls applyDerivedStateFromProps()?
applyDerivedStateFromProps() is called by 1 function(s): mountClassInstance.

Analyze Your Own Codebase

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

Try Supermodel Free