Home / File/ repro-object-fromEntries-entries.js — react Source File

repro-object-fromEntries-entries.js — react Source File

Architecture documentation for repro-object-fromEntries-entries.js, a javascript file in the react codebase. 2 imports, 0 dependents.

File javascript TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf["repro-object-fromEntries-entries.js"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 9d5c3d7d_19a7_e6cc_db63_cd5f2a41d3bf fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @validatePreserveExistingMemoizationGuarantees
import {useMemo} from 'react';
import {Stringify} from 'shared-runtime';

// derived from https://github.com/facebook/react/issues/32261
function Component({items}) {
  const record = useMemo(
    () =>
      Object.fromEntries(
        items.map(item => [item.id, ref => <Stringify ref={ref} {...item} />])
      ),
    [items]
  );

  // Without a declaration for Object.entries(), this would be assumed to mutate
  // `record`, meaning existing memoization couldn't be preserved
  return (
    <div>
      {Object.entries(record).map(([id, render]) => (
        <Stringify key={id} render={render} />
      ))}
    </div>
  );
}

export const FIXTURE_ENTRYPOINT = {
  fn: Component,
  params: [
    {
      items: [
        {id: '0', name: 'Hello'},
        {id: '1', name: 'World!'},
      ],
    },
  ],
};

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does repro-object-fromEntries-entries.js do?
repro-object-fromEntries-entries.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 repro-object-fromEntries-entries.js?
repro-object-fromEntries-entries.js defines 1 function(s): Component.
What does repro-object-fromEntries-entries.js depend on?
repro-object-fromEntries-entries.js imports 2 module(s): react, shared-runtime.
Where is repro-object-fromEntries-entries.js in the architecture?
repro-object-fromEntries-entries.js is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/repro-object-fromEntries-entries.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