File size: 432 Bytes
74aacd5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import { Options, useHotkeys } from 'react-hotkeys-hook'
import { useRecoilValue } from 'recoil'
import { appState } from '../store/Atoms'

const useHotKey = (
  keys: string,
  callback: any,
  options?: Options,
  deps?: any[]
) => {
  const app = useRecoilValue(appState)

  const ref = useHotkeys(
    keys,
    callback,
    { ...options, enabled: !app.disableShortCuts },
    deps
  )
  return ref
}

export default useHotKey