Home / File/ capture-ref-for-later-mutation.tsx — react Source File

capture-ref-for-later-mutation.tsx — react Source File

Architecture documentation for capture-ref-for-later-mutation.tsx, a tsx file in the react codebase. 2 imports, 0 dependents.

File tsx TestingUtilities Fixtures 2 imports 1 functions

Entity Profile

Dependency Diagram

graph LR
  48732956_1ae6_ece2_b828_ad6b9858be3a["capture-ref-for-later-mutation.tsx"]
  ac587885_e294_a1e9_b13f_5e7b920fdb42["react"]
  48732956_1ae6_ece2_b828_ad6b9858be3a --> ac587885_e294_a1e9_b13f_5e7b920fdb42
  006eec3d_77a9_4a47_e6c1_a96d7a6c9c05["shared-runtime"]
  48732956_1ae6_ece2_b828_ad6b9858be3a --> 006eec3d_77a9_4a47_e6c1_a96d7a6c9c05
  style 48732956_1ae6_ece2_b828_ad6b9858be3a fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

// @enableReactiveScopesInHIR:false
import {useRef} from 'react';
import {addOne} from 'shared-runtime';

function useKeyCommand() {
  const currentPosition = useRef(0);
  const handleKey = direction => () => {
    const position = currentPosition.current;
    const nextPosition = direction === 'left' ? addOne(position) : position;
    currentPosition.current = nextPosition;
  };
  const moveLeft = {
    handler: handleKey('left'),
  };
  const moveRight = {
    handler: handleKey('right'),
  };
  return [moveLeft, moveRight];
}

export const FIXTURE_ENTRYPOINT = {
  fn: useKeyCommand,
  params: [],
};

Subdomains

Functions

Dependencies

  • react
  • shared-runtime

Frequently Asked Questions

What does capture-ref-for-later-mutation.tsx do?
capture-ref-for-later-mutation.tsx is a source file in the react codebase, written in tsx. It belongs to the TestingUtilities domain, Fixtures subdomain.
What functions are defined in capture-ref-for-later-mutation.tsx?
capture-ref-for-later-mutation.tsx defines 1 function(s): useKeyCommand.
What does capture-ref-for-later-mutation.tsx depend on?
capture-ref-for-later-mutation.tsx imports 2 module(s): react, shared-runtime.
Where is capture-ref-for-later-mutation.tsx in the architecture?
capture-ref-for-later-mutation.tsx is located at compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.tsx (domain: TestingUtilities, subdomain: Fixtures, directory: compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork).

Analyze Your Own Codebase

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

Try Supermodel Free