Skip to main content

How to create key event

create your app

import { useKey } from 'rege/react'

export const App = () => {
const { ref } = useKey(console.log)
return <span ref={ref} style={style} />
}

with Key component

You can use shorthands Key component

import { Key } from 'rege/react'

export const App2 = () => {
return (
<Key onKey={console.log}>
{({ ref }) => <span ref={ref} style={style} />}
</Key>
)
}