I am curious about putting ‘x-chattrbox/u’ in the constructor of UserStore. What is the significance of the x-
and the /u
?
Hi @ballgeier! Sorry about the delay in response.
This is 100% convention, so there is no special meaning to the browser—it imitates namespacing and prevents name collisions if you have multiple web apps served on the same domain (since session storage is shared by domain).
I think x-
prefix is an imitation of the convention for defining custom headers, but some folks adopt other conventions. Here’s one that’s influenced by Java packages/namespaces: bnr.chattrbox.user
The /u
is shorthand for user
, that way your Chattrbox app could have multiple entries in localStorage without colliding. But you are welcome to adopt your own conventions. There is no special meaning to sessionStorage, so long as you prevent any name collisions with other web apps on your domain and can uniquely define multiple keys for your app