Home / File/ array-map-named-callback-cross-context.js — react Source File

array-map-named-callback-cross-context.js — react Source File

Architecture documentation for array-map-named-callback-cross-context.js, a javascript file in the react codebase. 1 imports, 0 dependents.

File javascript TestingUtilities Fixtures 1 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  a3c2b1a8_4d89_eee4_ab15_3083c65b523a["array-map-named-callback-cross-context.js"]
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  a3c2b1a8_4d89_eee4_ab15_3083c65b523a --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style a3c2b1a8_4d89_eee4_ab15_3083c65b523a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import {Stringify} from 'shared-runtime';

/**
 * Forked from array-map-simple.js
 *
 * Named lambdas (e.g. cb1) may be defined in the top scope of a function and
 * used in a different lambda (getArrMap1).
 *
 * Here, we should try to determine if cb1 is actually called. In this case:
 * - getArrMap1 is assumed to be called as it's passed to JSX
 * - cb1 is not assumed to be called since it's only used as a call operand
 */
function useFoo({arr1, arr2}) {
  const cb1 = e => arr1[0].value + e.value;
  const getArrMap1 = () => arr1.map(cb1);
  const cb2 = e => arr2[0].value + e.value;
  const getArrMap2 = () => arr1.map(cb2);
  return (
    <Stringify
      getArrMap1={getArrMap1}
      getArrMap2={getArrMap2}
      shouldInvokeFns={true}
    />
  );
}

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

Dependencies

  • shared-runtime

Frequently Asked Questions

What does array-map-named-callback-cross-context.js do?
array-map-named-callback-cross-context.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-named-callback-cross-context.js?
array-map-named-callback-cross-context.js defines 1 function(s): useFoo.
What does array-map-named-callback-cross-context.js depend on?
array-map-named-callback-cross-context.js imports 1 module(s): shared-runtime.
Where is array-map-named-callback-cross-context.js in the architecture?
array-map-named-callback-cross-context.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/array-map-named-callback-cross-context.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