<> cal Storage
Presented by
Copyright By PowCoder代写 加微信 powcoder
Persistence
State in React and JavaScript is transient, meaning we lose it after a page refresh
Sometimes we want data to be persistent between sessions
This can be done using a database, or stored client-side via localstorage
What is Local Storage?
window.localStorage is an API that allows you to read and write to a storage object in the document The stored data in this storage object is persisted between sessions
This means we can save and retrieve data when a user closes their tab or browser
When should I not use Local Storage?
1.When security of data is important 2.For large amounts of data
(localstorage has limited storage) 3.For complex data (only stores strings) 4.Data needed on multiple devices
When should I use Local Storage?
1.When there is no server
2.For data which is not crucial if it is lost
(e.g. or remembering view options or user settings)
Pros and Cons
Localstorage API
;)(raelc.egarotSlacol
egarotslacol morf smeti lla evomeR //
;)yek(metIevomer.egarotSlacol
egarotslacol morf yek nevig a htiw meti na evomeR //
;)yek(metIteg.egarotSlacol = eulav tsnoc
yek a nevig egarotslacol morf meti na seveirteR //
;)eulav ,yek(metItes.egarotSlacol
eulav dna yek eht nevig meti atad a ddA //
Local storage example
程序代写 CS代考 加微信: powcoder QQ: 1823890830 Email: powcoder@163.com