Answers for "save data in local storage reactjs returns [object, object]"

3

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'));
Posted by: Guest on October-14-2020

Code answers related to "save data in local storage reactjs returns [object, object]"

Code answers related to "Javascript"

Browse Popular Code Answers by Language