Geek Culture
Published in

Geek Culture

What Is localStorage?

LocalStorage in one of my activities back when I was doing coding practice
. I was aware of its reality when we were educated of utilizing it to endure information for JWT validation and that is all I was aware of it.

Little did I know there is more usage of localStorage than tokens!
Let’s take a quick look together and learn a little bit of what is localStorage?


An example of that is this:

At the point when you recover information from a Storage object, you’ll generally get the information as a string. Same with sessionStorage and Cookies. You can likewise store objects in the localStorage. We would simply need to utilize JSON.stringify() to store the item.

Like as you can see, once stored, the whole object turns into a string even when trying to get the data back. But this data can be converted back to an object by using JSON.parse().

Just like this;

Limit and Usage

Some say that most current internet browsers permit you to save to 5MB, while others say it’s near limitless.

With regards to putting away information, localStorage keeps it until the program is shut or until you run the localStorage.clear() order.

On my past project, I utilized localStorage.clear() when the client logs out of the web application and gets out any token put away in the program.

Look at it here on our handleLogout work;

Part of the component that toggles the theme is an onClick eventListener that triggers a switchTheme function that contains an if statement use.
See that the primary utilization of the localStorage is to truly store key-esteem sets which can be utilized on numerous different things.

So that is it! I trust you had a good time looking through this blog about localStorage and ideally helped you here and there in enduring information other than treats or state.

Do you have some other experience of utilizing localStorage in an alternate manner? Tell me in the remarks underneath! I couldn’t imagine anything better than to give them a shot!




A new tech publication by Start it up (

Recommended from Medium

Instant Messaging with Jitsi Meet, Gifted Chat, React Native, and Redux

Conditionals in JSX

Week notes 3 — Ghostbusters, a breakfast bot and JavaScript 👻 🥣 🤖(19th April)

Test config with typescript and mongodb-Memory-Server

A Practical Example of React Lifecycle Events

Javascript | Composition vs Inheritance

Showing Weather Forecast Using A Modal

Let’s look at how React Native Component Libraries can help you save time and money.

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
Fareeha Rana

Fareeha Rana

Full-Stack web Developer | Design enthusiast! Currently venturing the world of Software Engineering.

More from Medium

Personality quiz with React & graph data structure

Build an interactive Map with React and React Leaflet

6 Techs to become most wanted fullstack developer + amazing courses

Thinking In React