Home / Function/ warnOnUndefinedDerivedState() — react Function Reference

warnOnUndefinedDerivedState() — react Function Reference

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

Entity Profile

Dependency Diagram

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

Relationship Graph

Source Code

packages/react-server/src/ReactFizzClassComponent.js lines 65–79

function warnOnUndefinedDerivedState(type: any, partialState: any) {
  if (__DEV__) {
    if (partialState === undefined) {
      const componentName = getComponentNameFromType(type) || 'Component';
      if (!didWarnAboutUndefinedDerivedState.has(componentName)) {
        didWarnAboutUndefinedDerivedState.add(componentName);
        console.error(
          '%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' +
            'You have returned undefined.',
          componentName,
        );
      }
    }
  }
}

Domain

Subdomains

Frequently Asked Questions

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

Analyze Your Own Codebase

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

Try Supermodel Free