02. useState πŸ‘©β€πŸŽ“πŸ‘¨β€πŸŽ“

useState

In this activity, we will practice using the useState Hook in React.

Instructions

  • Replace your React application’sΒ srcΒ folder with starter/src.

  • If you created a new React app, you will need to install Bootstrap by running npm install --save bootstrap and adding import 'bootstrap/dist/css/bootstrap.min.css'; in index.js.

  • Start the application in dev mode by running npm start in your terminal.

  • Open your browser toΒ localhost:3000Β and study the rendered application.

  • Update this application to accomplish the following:

  • In pages/Signup/index.js, replace NAME_HERE and PASSWORD_HERE with code that will display both the name and password.

  • The state of the Signup component should be handled by the useState Hook.

  • When the value of an input field changes, the state should update, causing the component to render.

  • Upon form submission, the handleSubmit method should console.log the username and password.


βœ… Solutions

Solutions Click Here