
The symbol is called Fragments and can be used instead of or any other tag. In react, you can return only one element/component/tag. The return statement is the stuff that will be visible on the browser. So, the string an empty string is the initial value of the input. The value between the brackets while declaring useState is the initial value. The syntax given above is the way we declare the hook, where input is where the value will be stored and setInput() is a function that input value. Values in useState do not change/get wiped even after re-render. But why don’t we use variables instead?īecause if we do use variables, the data stored in that variable will be wiped when react re-renders the view upon state change. Simply put, we are using this hook to store the input value. This hook allows us to track the state (data or properties) of a functional component. On the first 2 lines, we are importing the useState hook from React and styles from App.css.

Let’s go line by line to understand what is going on. To get started with react, open your terminal/command prompt and type in the following command npx create-react-app todo-app Make sure you have node and npm installed. You can use the previously used components multiple times in the project. Building your application like this makes developing, scaling and maintaining the application much more simple. For example, if you are building a chat app, the window screen will be a different component, chat bubbles will be a different component, the text box will be a different component.


React is a javascript library for building user interfaces. This is the live demo of the app we will be creating. Our goal for today is to look at React, understand its workings, and create a to-do list app with what we have learned. It is simple to implement while teaching the bare basics of the framework and the satisfaction of creating a fully working application. Business vector created by jcomp - Creating a to-do app with a framework is the equivalent of writing a ‘ Hello World’ program.
