What I found interesting in React


The most popular JavaScript tool is now React. And, How it keep its supremacy? I found some interesting reasons for that. I going to demonstrate it here.

Component: React is all about components. For every single task, you can add components. We can create content in two ways class base component and functional component. The current most used and useful component way is a functional component. We can work on multiple components. Also, we can pass data from the parent component to the chield component.

Event Handling: Handling event in React is easier than vanilla JavaScript. for example if you want to add a client event on an element. You can just add onClick and declare a function.

Data Fetching: React has its own way to call API. using useEffect inside you can fetch data from an API. also, you can add the dependency on that element.

Hooks: React uses various hooks to lightweight your app. useState, useEffect, useRef are most used. You can create a custom hook as you needed.

Context: When an app has a more nested component, then, it needs to pass data from one component to another. The normal way is to pass from one component to another. But context made it easier than you can send data from one component to another without nesting.

Conditional Rendering: You can render some state and components based on your app behavior. If you want to show something which depends on another you show conditional rendering there.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store