My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more

React - Keydown event is taking 500ms and the same function via onClick take 50ms

Sobin George Thomas's photo
Sobin George Thomas
·Oct 9, 2020·

1 min read

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?

#react