7. Portals & Refs
Activity 7.1: Extract User Input Values
In this activity, you have to add logic to an existing React component to extract values from a form. The form contains an input field and a drop-down menu and you should make sure that, upon form submission, both values are read and, for the purpose of this dummy app, output to the browser console.
Use your knowledge about refs and uncontrolled components to implement a solution without using React state.
Note
You can find the starting code for this activity at https://packt.link/PAvKn. When downloading this code, you'll always download the entire repository. Make sure to then navigate to the subfolder with the starting code (activities/practice-1/starting-code
in this case) to use the right code snapshot.
After downloading the code and running npm install
in the project folder (to install all the required dependencies), the solution steps are as follows:
- Inside the
Form
component, create two...