function useHeldKeys(): string[];
Defined in: useHeldKeys.ts:26
React hook that returns an array of currently held keyboard keys.
This hook uses useStore from @tanstack/react-store to subscribe to the global KeyStateTracker and updates whenever keys are pressed or released.
string[]
Array of currently held key names
function KeyDisplay() {
const heldKeys = useHeldKeys()
return (
<div>
Currently pressed: {heldKeys.join(' + ') || 'None'}
</div>
)
}