Home / File/ array-map-simple.js — react Source File

array-map-simple.js — react Source File

Architecture documentation for array-map-simple.js, a javascript file in the react codebase.

Entity Profile

Relationship Graph

Source Code

/**
 * Test that we're not hoisting property reads from lambdas that are created to
 * pass to opaque functions, which often have maybe-invoke semantics.
 *
 * In this example, we shouldn't hoist `arr[0].value` out of the lambda.
 * ```js
 * e => arr[0].value + e.value  <-- created to pass to map
 * arr.map(<cb>)                <-- argument only invoked if array is non-empty
 * ```
 */
function useFoo({arr1, arr2}) {
  const x = arr1.map(e => arr1[0].value + e.value);
  const y = arr1.map(e => arr2[0].value + e.value);
  return [x, y];
}

export const FIXTURE_ENTRYPOINT = {
  fn: useFoo,
  params: [{arr1: [], arr2: []}],
  sequentialRenders: [
    {arr1: [], arr2: []},
    {arr1: [], arr2: null},
    {arr1: [{value: 1}, {value: 2}], arr2: [{value: -1}]},
  ],
};

Subdomains

Functions

Frequently Asked Questions

What does array-map-simple.js do?
array-map-simple.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 array-map-simple.js?
array-map-simple.js defines 1 function(s): useFoo.
Where is array-map-simple.js in the architecture?
array-map-simple.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/array-map-simple.js (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects).

Analyze Your Own Codebase

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

Try Supermodel Free