Learning Some Important Concepts of React Js (part-2)
This is the second part of the important concepts of ReactJs and in this part, we will be discussing some more concepts that we should learn.

Search for a command to run...
This is the second part of the important concepts of ReactJs and in this part, we will be discussing some more concepts that we should learn.

No comments yet. Be the first to comment.
Every October, the developer community buzzes with Hacktoberfest energy. PRs fly, t-shirts are earned, and GitHub turns green. But here's what nobody talks about: what happens in November? For most contributors, the answer is simple: nothing. The rep...

The debate over AI coding agents is missing the most important factor. It’s not about prompt engineering, it’s about understanding the context window. Developers are divided. One side claims coding agents suck. The other insists you’re just using the...

Learnings from a Research Paper

Lately, I have been working on a feature to capture images from media streams and scale them down to reduce their size. This helps save storage and reduce costs before uploading the images to a storage service. For this, I used Canvas to render the i...

AI helps you do more, but only if you know the basics well enough to tell it what you want.

In a previous article that is part-1, we discussed some important concepts of React js.
%[INVALID_URL]This is the second part of the important concepts of ReactJs and in this part, we will be discussing some more concepts that we should learn.
List of things that we'll discuss in this article.
when we start learning React we hear this term often but what exactly is components?
Well, components are the building blocks of your application. it could be anything for example sidebar of your application or the navbar of your application.

In the above picture, you can see there is one parent component which contains two other components that is main and sidebar.
sidebar components also contains 2 more components are about and 'links`. and rest you can see yourself.
the takeaway is when you plan your application always try to plan your application considering components. because that's how you can build large applications.
Note: Facebook like the giant company has around 50k components of React.
The state is nothing but a set of properties or object which belongs to a particular component. whenever the state changes the component re-renders.
For example: let say you are making an authentication and authorization system. you want some part of your application only accessible by an authenticated user. so, you need to keep track of user is authenticated or not.

In the above example, you can see we have used the isAuth state to render the Dashboard component. if it is true we render Dashboard otherwise null.
the takeaway is state is your component manager which decides how and when a component will render.
The prop is how Components get their properties. Starting from the top component, every child component gets its props from the parent.
For example: let say you want to render a list of blog posts in your application for that you required dynamic data for every post. so, here you will pass down the props(properties to the single blog component).

The takeaway is props are useful when you want to pass information to the child components.
In React components are often divided into 2 Types: presentational components and container components.
Each of those has its unique characteristics.
Presentational components are mostly used for generating some markup. They don't manage any kind of state.
Container components are mostly concerned with the "backend" operations. They might handle the state of various sub-components. They might wrap several presentational components.
As a way to simplify the distinction, we can say presentational components are concerned with the look, container components are concerned with making things work.
As we know In react component we can only return one element at a time for that we always use the <div> tag to wrap other elements.
but every time when we wrap elements inside the <div> tag we are just creating another node in DOM and it is not efficient.
for this react the developer come up with React Fragments which overcome this problem.
to wrap elements we use Fragments. that is <Fragment></Fragment> or <> </>.

And that’s it for this topic. Thank you for reading.