Код: Выделить всё
const triggerFunc = (e) => {
if(e.key == props.key) {
clickFunc()
}
}
React.useEffect(() => {
document.addEventListener('keydown', triggerFunc)
return () => {
document.removeEventListener('keydown', triggerFunc)
}
}, [])
Подробнее здесь: https://stackoverflow.com/questions/758 ... rops-value