17. Refs in React
Activity 17.01: Creating a Form with an Autofocus Input Element
Solution:
- Create a new React app using the create-react-app CLI:
$ npx create-react-app autofocus-form
- Move into the new React applications folder and start the
create-react-appdevelopment server:$ cd autofocus-form/ && npm start
- Inside the
App.jsfile, change theAppcomponent to only return a plainformÂcomponent:import React from "react"; class App extends React.Component { Â Â render() { Â Â Â Â return <form />; Â Â } } export default App; - Inside the
formcomponent, add three input fields – one forfirstname, one forlastname, and a third one foremail:class App extends React.Component {   render() {     return (       <form>         <input type="text" placeholder="firstname" />...