Created
October 2, 2021 05:46
-
-
Save lcds90/388928b9b2b0f2d8f9e81548576348a4 to your computer and use it in GitHub Desktop.
Local Storage JSON parse e stringify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Funções prontas para guardar e resgatar itens no localStorage. | |
export const saveLocalStorage = (key, payload) => { | |
localStorage.setItem(key, JSON.stringify(payload)); | |
}; | |
export const getLocalStorage = (key) => JSON | |
.parse(localStorage.getItem(key)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment