Todo.js - This is where all of our functional components will go. We will create a components folder in the src directory and add two files within it: Running the last command will start the development server on port 3000 and open up a new page on our web browser: We run the command on the third line because we want to install specific versions of react and react-dom (currently in alpha) in order to tap into React Hooks Let’s create a new React application using the create-react-app CLI tool: $ npx create -react -app react -todo -hooks If you want to play around with React Hooks, you will need the alpha build of React as this feature is still in alpha (as at the time of writing this article). To get the most out of this tutorial, you need knowledge of JavaScript and the React framework. To follow along with this tutorial, you’ll need the following tool create-react-app installed. If you aren’t already familiar with these methods and their uses, please refer to this article. In a previous article, we introduced React Hooks and looked at some ways to use the useState() and useEffect() methods. In this article, we will build a todo application using functional components and Hooks to manage state, here’s a display of what we will have at the end of this tutorial: Note: To try out React Hooks, you will need the alpha build of React (at time of publication) Introduction You will need Create React App installed on your machine.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |