Managing state in React Application? Yeah, 8 ways to do it.

No hard and fast rule, choose the one you like.

Danyal Jamil
5 min readSep 27, 2021

It’s been so long since my last post on Web Development. So, here is another one.

In this post, I will mention 8 ways to handle state in a React application. And for the newbies, myself included, a State is simply something that stores a data of the application that might be changed at some point.

So, as state is out of the way now, let’s dive in.

Methods to save a state

We have a brief history of React.

Image from here

We can see the initially we only had class based components in React, and it was not until 2015 that functional components were introduced to the world.

We won’t discuss which is better and what we should use, but generally, now-a-days Functional Components are the way to go.

We will discuss techniques related to Class Components, Stateless functional components, Context API, and hooks for here.

Let me clear Environment variables first, they are environment-specific variables that

--

--