Home / File/ constant-prop.e2e.js — react Source File

constant-prop.e2e.js — react Source File

Architecture documentation for constant-prop.e2e.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript 2 imports

Entity Profile

Dependency Diagram

graph LR
  ea6761bc_41f2_55ad_5518_b021af81406f["constant-prop.e2e.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  ea6761bc_41f2_55ad_5518_b021af81406f --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  9adf9051_2ce4_6a22_5a47_ad6ee61b1f13["react"]
  ea6761bc_41f2_55ad_5518_b021af81406f --> 9adf9051_2ce4_6a22_5a47_ad6ee61b1f13
  style ea6761bc_41f2_55ad_5518_b021af81406f fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

/**
 * Copyright (c) Meta Platforms, Inc. and affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

import * as React from 'react';
import {render} from '@testing-library/react';

globalThis.constantValue = 'global test value';

test('literal-constant-propagation', () => {
  function Component() {
    'use memo';
    const x = 'test value 1';
    return <div>{x}</div>;
  }
  const {asFragment, rerender} = render(<Component />);

  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
      <div>
        test value 1
      </div>
    </DocumentFragment>
  `);

  rerender(<Component />);

  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
      <div>
        test value 1
      </div>
    </DocumentFragment>
  `);
});

test('global-constant-propagation', () => {
  function Component() {
    'use memo';
    const x = constantValue;

    return <div>{x}</div>;
  }
  const {asFragment, rerender} = render(<Component />);

  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
      <div>
        global test value
      </div>
    </DocumentFragment>
  `);

  rerender(<Component />);

  expect(asFragment()).toMatchInlineSnapshot(`
    <DocumentFragment>
// ... (72 more lines)

Dependencies

  • react
  • react

Frequently Asked Questions

What does constant-prop.e2e.js do?
constant-prop.e2e.js is a source file in the react codebase, written in javascript.
What does constant-prop.e2e.js depend on?
constant-prop.e2e.js imports 2 module(s): react, react.
Where is constant-prop.e2e.js in the architecture?
constant-prop.e2e.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/e2e/constant-prop.e2e.js (directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/e2e).

Analyze Your Own Codebase

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

Try Supermodel Free