Reputation: 1283
I am making a chat application and i saw that whatsapp doesn't allow the use of space bar when there is no input yet, i did try to find it out in stack overflow itself but they gave the answer which worked only there, but when i tried in my react-app it showed this error:
Unexpected use of 'event' no-restricted-globals
I am confused what to do, i got this at the first time:
Then i went to the file and tried commenting the line(not sure if can), but that too didn't work for me. Like is there any other way i can achieve the same functionality without the use event
Upvotes: 0
Views: 133
Reputation: 211570
What is keyhandler
defined as? You should define it as function keyhandler(event)
but inline it as onKeyDown={keyhandler}
with no arguments.
You want to pass in a function to be called, not a specific function call. These are two different things.
The error indicates that event
isn't what you think it is, that's resolved to window.event
, it doesn't exist like you think it does, because that is now a function call with a static argument instead of the actual event that happened.
Upvotes: 1