Home / Function/ warnOnUndefinedDerivedState() — react Function Reference

warnOnUndefinedDerivedState() — react Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  659d9471_e821_a589_6978_568ced15f6d2["warnOnUndefinedDerivedState()"]
  3805476a_1924_0e35_fff7_6afad197a523["ReactFiberClassComponent.js"]
  659d9471_e821_a589_6978_568ced15f6d2 -->|defined in| 3805476a_1924_0e35_fff7_6afad197a523
  9f4500d1_a30b_b3dc_2405_2ab2117c51e4["applyDerivedStateFromProps()"]
  9f4500d1_a30b_b3dc_2405_2ab2117c51e4 -->|calls| 659d9471_e821_a589_6978_568ced15f6d2
  style 659d9471_e821_a589_6978_568ced15f6d2 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/react-reconciler/src/ReactFiberClassComponent.js lines 113–127

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-reconciler/src/ReactFiberClassComponent.js.
Where is warnOnUndefinedDerivedState() defined?
warnOnUndefinedDerivedState() is defined in packages/react-reconciler/src/ReactFiberClassComponent.js at line 113.
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