Home / File/ maybe-mutate-object-in-callback.js — react Source File

maybe-mutate-object-in-callback.js — react Source File

Architecture documentation for maybe-mutate-object-in-callback.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

const {mutate} = require('shared-runtime');

function Component(props) {
  const object = {};
  // We optimistically assume function calls within callbacks don't mutate (unless the function
  // is known to be called during render), so this should get memoized
  const onClick = () => {
    mutate(object);
  };
  return <Foo callback={onClick}>{props.children}</Foo>;
}

function Foo({children}) {
  return children;
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [{children: <div>Hello</div>}],
};

Subdomains

Functions

Frequently Asked Questions

What does maybe-mutate-object-in-callback.js do?
maybe-mutate-object-in-callback.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 maybe-mutate-object-in-callback.js?
maybe-mutate-object-in-callback.js defines 2 function(s): Component, Foo.
Where is maybe-mutate-object-in-callback.js in the architecture?
maybe-mutate-object-in-callback.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/maybe-mutate-object-in-callback.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