Lesson
Detect click on back button using React useEffect y useState
When working in the navigation aspect of a web application, is a common need to handle the back button event, in this situation knowing when the click was made is required. In this example we use react-router to create a simple application with navigation. We...
- Duration
- 1 min
- Access
- Free
- Transcript
- Available
When working in the navigation aspect of a web application, is a common need to handle the back button event, in this situation knowing when the click was made is required.
In this example we use react-router to create a simple application with navigation. We will create a new component that use the event handler window.onpopstate inside useEffect hook to detect the click on the button.