Use-case: I am currently working on a larger software, which consist of three different components. Every component has configurations, which I want to save in cookies, if the sessions is closed. If I reopening the website, the same configurations for every component should be restored.
Here is my question: Is it a good practice to save all configurations in one cookie or save the configurations for a component in an own cookie? All configurations are objects and consists of more then >10 properties.
Thanks for your help. :)
If the configurations are to be stored for the current browser only, I would store the complete object with JSON.encode(obj) in localStore:
Something like:
localStorage.setItem('objectName', JSON.stringify(myObject));
And to get the object:
var myObject = JSON.parse(localStorage.getItem('objectName'));