What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-15 18:19:05
save data in local storage reactjs returns [object, object]
Local Storage is key-value storage where key is string and value is string also. You must stringify your data, you can do this localStorage.setItem('user', JSON.stringify(user)); And get it like const user = JSON.parse(localStorage.getItem('user')); Add solution -
Javascript 2021-09-15 15:39:02
localstorage js
var testObject = { 'one': 1, 'two': 2, 'three': 3 }; // Put the object into storage localStorage.setItem('testObject', JSON.stringify(testObject)); // Retrieve the object from storage var retrievedObject = localStorage.getItem('testObject'); console.lo... Add solution -
Javascript 2021-09-14 20:26:02
local storage in vanila javascript
// Store data var someData = 'The data that I want to store for later.'; localStorage.setItem('myDataKey', someData); // Get data var data = localStorage.getItem('myDataKey'); // Remove data localStorage.removeItem('myDatakey'); Add solution -
Javascript 2021-09-10 15:18:03
angular 12 service for create update delete local storage items
import { Injectable } from '@angular/core'; import { Subject } from 'rxjs'; @Injectable({ providedIn: 'root' }) export class LocalStorageService { localStorage: Storage; changes$ = new Subject(); constructor() { this.localStorage = window.lo... Add solution -
Javascript 2021-09-09 10:34:02
how to setItem and getItem in javascript in localStorage
function set(){ var sendJSON = JSON.stringify(allMovie); localStorage.setItem('allMovie',sendJSON) } function get(){ var getJSON = localStorage.getItem('allMovie'); if (getJSON){ allMovie = JSON.parse(getJSON) } } Add solution
Best helpers
Ranking is empty