package.src.BoundHotkeysProxyProvider.tsx Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of react-hotkeys-hook Show documentation
Show all versions of react-hotkeys-hook Show documentation
React hook for handling keyboard shortcuts
The newest version!
import { createContext, ReactNode, useContext } from 'react'
import { Hotkey } from './types'
type BoundHotkeysProxyProviderType = {
addHotkey: (hotkey: Hotkey) => void
removeHotkey: (hotkey: Hotkey) => void
}
const BoundHotkeysProxyProvider = createContext(undefined)
export const useBoundHotkeysProxy = () => {
return useContext(BoundHotkeysProxyProvider)
}
interface Props {
children: ReactNode
addHotkey: (hotkey: Hotkey) => void
removeHotkey: (hotkey: Hotkey) => void
}
export default function BoundHotkeysProxyProviderProvider({ addHotkey, removeHotkey, children }: Props) {
return (
{children}
)
}