Skip to content

State Management in JavaScript

Last updated on March 27, 2020

In this blog post, I would like to give you a simple introduction to State Management in JavaScript. You want to check out the Building Blocks of State Management

Introduction

State Management is so popular in front-end web development. In order to use this effectively, we should know it’s history.

Here we will see, What really State Management is??? What problem it tries to solve And Where this would fit??

State Management in JavaScript

Before answering the above questions first, we will figure out how we keep the raw data and syncing the same in frontend applications.

Generally, we use Session, Local/Session storage to maintain the data.

But those techniques might leak the data to the outside world which is a major drawback.

To save from the above PROBLEM we got State Management and it is a solution to maintain a state (or) data in a single place.

In a nutshell,  State Management helps to keep the data in a single object and maintain in one place.

In addition to the problem solving case, this promotes change on data by 1Directional. So the prediction about data changes is easy.

When You Need State Management

You will need a state management solution only when you’re interested on the data you keep modifying.

You don’t need to worry about this only WHEN we least bothered about maintaining data related changes.

This solution is a great deal for enterprise web applications.

State Management Tools

To support state management in each JavaScript frameworks, you will have dedicated libraries like NgRx / NGXS (Angular), Redux (React.js) and Vuex (Vue.js).

Published inAngularFrameworksJavaScriptReact