React - Keydown event is taking 500ms and the same function via onClick take 50ms
I am trying to create a keyboard shortcut for my react-redux application. The keydown function takes 500 ms and if I do the same via the onClick function it takes 50ms. I have tried the same by creating a production version but no good results.
A hack I tested was to call an onClick event inside the keydown function which take lesser time than the original function. I also tried using Chrome Memory Profiler to see that's wrong. But no luck.
Can anyone suggest any solution to debug this problem?
3.4K+ developers have started their personal blogs on Hashnode in the last one month.
Write in Markdown · Publish articles on custom domain · Gain readership on day zero · Automatic GitHub backup and more