Now that you've learned how to work with events in React, it's time to build something and put those skills to use! Your goal for this lab is to add events in React to practice building event handling.
You are working with a client to create a new password input within their website. They would like to keep track of when the user is typing as well as when the user hovers over and away from the submit button. This is to help with checking the cadence of their typing and the movement of their mouse for the purpose of adding anti-botting security for their user. Your task is to add these three events and functions related to the events so that the security engineer can easily come in and apply their anti-bot measures easily.
- Create a password input that will track the changing of text and the mouse movements.
└── App
├── PasswordInput
└── SubmitButton
- Create
PasswordInput
React component - Render an
<input>
with a password type
- Create a
SubmitButton
React component - Render a
<button>
with the text “Submit Password”
- Add a change event to the
<input>
- Add a mouse enter event to the
<button>
- Add a mouse leave event to the
<button>
- Create a
handleChange
function - Add a
console.log
to print out “Entering password…”
- Create a
handleEnter
function - Add a
console.log
to print out “Mouse Entering” - Create a
handleLeave
function - Add a
console.log
to print out “Mouse Exiting”
- Debugging and testing during coding
- GitHub Repository: React Event Handling Vite Lab
- Event Handling in React: React Documentation