liveBook · Manning

Local storage

Also called localStorage

Local storage is a browser-provided, origin-scoped key-value storage mechanism for string data that persists across sessions.

How 4 Manning books explain it

Acing the Frontend Interview

localStorage is a browser storage area that persists string key-value data across page loads and browser sessions for a given origin.

How it is used
Supports small, non-sensitive client-side persistence such as user preferences across page loads and browser sessions.
How deep it goes
Explains feature detection, core methods, string coercion, storage limits, synchronous operations, and security considerations.
Examples
Uses persisted user preferences and demonstrates number, array, object, boolean, null, and undefined conversions to strings.
What you can do after
Operate localStorage safely for small preferences by detecting support, managing entries, and accounting for serialization and sensitivity.

Read how Acing the Frontend Interview explains local storage →

Web Components in Action

Local storage is a browser-provided, origin-scoped key-value storage mechanism whose values are strings and can persist across browser sessions.

How it is used
Persists an editable workout plan so the application can reload a previously saved routine after the browser closes.
How deep it goes
Demonstrates string storage, origin-scoped keys, JSON serialization, enumeration, saving, loading, and clearing.
Examples
Uses string key-value snippets and a workout planner that saves, loads, lists, edits, and clears personal routines.
What you can do after
Operate local storage through setItem, getItem, Object.keys, JSON.stringify, and JSON.parse.

Read how Web Components in Action explains local storage →

HTML5 in Action

localStorage is a Web Storage interface whose client-side data persists across multiple sessions.

How it is used
Persists client-side application settings across sessions as an alternative to cookies or server-side storage.
How deep it goes
Walks through reading, writing, and deleting settings and connecting storage functions to the UI.
Examples
Uses a mobile task-management application’s name and color-scheme settings to demonstrate persistence.
What you can do after
Apply it via the Web Storage API to manage and restore application settings.

Read how HTML5 in Action explains local storage →

React Hooks in Action: With Suspense and Concurrent Mode

Local storage is a browser-provided key-value storage mechanism that persists string data across page visits.

How it is used
Persists a selected user so a page can restore the choice after revisits or refreshes.
How deep it goes
Demonstrates reading and writing values through effects, including mount-only and state-dependent dependency behavior.
Examples
Uses a user-selection dropdown whose saved choice is restored after refreshing the page.
What you can do after
Builds a React user picker that restores and persists its selected value with local storage.

Read how React Hooks in Action: With Suspense and Concurrent Mode explains local storage →

Also covered in

Related concepts

Questions about local storage

What is local storage?

Local storage is a browser-provided, origin-scoped key-value storage mechanism for string data that persists across sessions.

Which Manning books explain local storage?

Acing the Frontend Interview, Web Components in Action, HTML5 in Action and React Hooks in Action: With Suspense and Concurrent Mode.

What is the difference between local storage and cookie?

Local storage is a browser-provided, origin-scoped key-value storage mechanism for string data that persists across sessions. An HTTP cookie is a small piece of data stored by a client and sent with subsequent requests within its scope, often to maintain state or preferences.

What is local storage part of?

Local storage is part of web storage api. The Web Storage API is a browser API for storing string key-value data on the client side in origin-associated storage areas such as localStorage and sessionStorage.

What is local storage also called?

Local storage is also called localStorage.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.