6 تغريدة 1 قراءة Apr 13, 2023
Local Storage. What is it?
Thread 🧵👇
📌 What is local storage?
It is an API that lets you store data in the browser for extended periods of time.
Local storage can only save strings. If you need to save an array/object, convert it to string using JSON.stringify() and then save it in the local storage.
📌 Save data in local storage
Local storage provides a setItem() method that we can use to store data.
📌 Read data from local storage
You can get the data using the getItem() method. If you are retrieving an object/array, make sure you parse it afterward.
📌 Delete data from local storage
You can delete a single data entry using localstorage.removeItem() method.
If you want to clear everything, you can use the clear() method.
That’s all for now!
Follow @Rapid_API for more exclusive content. 🐙

جاري تحميل الاقتراحات...