Home / File/ array-map-named-chained-callbacks.js — react Source File

array-map-named-chained-callbacks.js — react Source File

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

Entity Profile

Relationship Graph

Source Code

/**
 * Forked from array-map-simple.js
 *
 * Here, getVal1 has a known callsite in `cb1`, but `cb1` isn't known to be
 * called (it's only passed to array.map). In this case, we should be
 * conservative and assume that all named lambdas are conditionally called.
 */
function useFoo({arr1, arr2}) {
  const getVal1 = () => arr1[0].value;
  const cb1 = e => getVal1() + e.value;
  const x = arr1.map(cb1);
  const getVal2 = () => arr2[0].value;
  const cb2 = e => getVal2() + e.value;
  const y = arr1.map(cb2);
  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-named-chained-callbacks.js do?
array-map-named-chained-callbacks.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-chained-callbacks.js?
array-map-named-chained-callbacks.js defines 1 function(s): useFoo.
Where is array-map-named-chained-callbacks.js in the architecture?
array-map-named-chained-callbacks.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/inner-function/nullable-objects/array-map-named-chained-callbacks.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