Nowadays react is one of the most popular libraries for making web applications. Let's see the basics of this library in an easy way.
You have noticed that I mentioned react as a library, not a framework. Because you cannot find a complete solution of making web app by using only react. You need many more things to implement a complete web application.
React is component based
Like other programming languages react has a component feature that is like a function. We can call the function as needed. Even can reuse as per necessity.
Create a component using ES6
Props and Components
The full meaning of props is properties. In react app Components can refer to other components in their output and the properties of one component can be sent to another component by using props.
In react events can be handled in some ways. One of the best ways is to binding calls and using the arrow function.
Conditional rendering is really an amazing thing. Let's explore it with some examples. Consider these two components
We’ll create a Greeting component that displays either of these components depending on whether a user is logged in: