DEV Community

Discussion on: Handle keyboard event with React Hooks

Collapse
 
ac37s profile image
e1cb4 ac37s • Edited

Simple example: on one route u have 1 component with hook specified above. U change route. Then go back. What will happen on specified keydown? Assume SPA with react router. This is simple example. There are tons more complicated ones. It's even that case when we have no deps and adding event on mount, useEffect is MUCH more flexible.