Home / File/ error.invalid-mutate-global-in-render-helper-phi-return-prop.js — react Source File

error.invalid-mutate-global-in-render-helper-phi-return-prop.js — react Source File

Architecture documentation for error.invalid-mutate-global-in-render-helper-phi-return-prop.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

function Component() {
  const renderItem = item => {
    // Multiple returns so that the return type is a Phi (union)
    if (item == null) {
      return null;
    }
    // Normally we assume that it's safe to mutate globals in a function passed
    // as a prop, because the prop could be used as an event handler or effect.
    // But if the function returns JSX we can assume it's a render helper, ie
    // called during render, and thus it's unsafe to mutate globals or call
    // other impure code.
    global.property = true;
    return <Item item={item} value={rand} />;
  };
  return <ItemList renderItem={renderItem} />;
}

Subdomains

Functions

Frequently Asked Questions

What does error.invalid-mutate-global-in-render-helper-phi-return-prop.js do?
error.invalid-mutate-global-in-render-helper-phi-return-prop.js is a source file in the react codebase, written in javascript. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in error.invalid-mutate-global-in-render-helper-phi-return-prop.js?
error.invalid-mutate-global-in-render-helper-phi-return-prop.js defines 1 function(s): Component.
Where is error.invalid-mutate-global-in-render-helper-phi-return-prop.js in the architecture?
error.invalid-mutate-global-in-render-helper-phi-return-prop.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/error.invalid-mutate-global-in-render-helper-phi-return-prop.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler).

Analyze Your Own Codebase

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

Try Supermodel Free