store data in localstorage in react js code example
Example: 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'));