useKeyCommand() — react Function Reference
Architecture documentation for the useKeyCommand() function in capture-ref-for-later-mutation.tsx from the react codebase.
Entity Profile
Dependency Diagram
graph TD c880e94b_60ec_90d1_6097_9a0f022f6904["useKeyCommand()"] 48732956_1ae6_ece2_b828_ad6b9858be3a["capture-ref-for-later-mutation.tsx"] c880e94b_60ec_90d1_6097_9a0f022f6904 -->|defined in| 48732956_1ae6_ece2_b828_ad6b9858be3a style c880e94b_60ec_90d1_6097_9a0f022f6904 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.tsx lines 5–19
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];
}
Domain
Subdomains
Source
Frequently Asked Questions
What does useKeyCommand() do?
useKeyCommand() is a function in the react codebase, defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.tsx.
Where is useKeyCommand() defined?
useKeyCommand() is defined in compiler/packages/babel-plugin-react-compiler/src/__tests__/fixtures/compiler/original-reactive-scopes-fork/capture-ref-for-later-mutation.tsx at line 5.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free