I have a handleBackspace
function that does something if backspace is being pressed.
I tried this:
const handleBackspace = (e) => {
if(e.keyCode === 8) {
console.log('1')
}
}
//
<input onKeyPress={handleBackspace}>
But that doesn't work. (I tried it with keyCode 13
[enter] and it worked. But keyCode 8
[backspace] doesn't work) Can someone show me a solution?