1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
useEffect(()=>{
const key = (e) => {
if (e.keyCode == 83 && (navigator.platform.match("Mac") ? e.metaKey : e.ctrlKey)){
e.preventDefault();
// alert('saved');
// $('#submit_').trigger('click')
saveMyCourse()
}
}
document.body.addEventListener('keydown', key);
return ()=> {
document.removeEventListener('keydown',key)
}
} ,[])
|