Describe the feature
The useState uses useNuxtApp().payload.state to preserve the value after server-side rendering and share the value across all components through a unique key. If useState is previously used with a key and if the key is the same, it will use the cached value regardless of whether it has a different init method or not. It is useful to use cached data when needed. However, in some cases, the value of useState needs to be redeclared with a new init method. It seems like the only way is creating unique key every time.
It would be nice to have just like clearNuxtData function to clear cached state value, so we don't have to think how to make a unique key when we want to change the value of useState
Additional information
Final checks
Describe the feature
The
useStateusesuseNuxtApp().payload.stateto preserve the value after server-side rendering and share the value across all components through a unique key. IfuseStateis previously used with a key and if the key is the same, it will use the cached value regardless of whether it has a differentinitmethod or not. It is useful to use cached data when needed. However, in some cases, the value ofuseStateneeds to be redeclared with a newinitmethod. It seems like the only way is creating unique key every time.It would be nice to have just like
clearNuxtDatafunction to clear cached state value, so we don't have to think how to make a unique key when we want to change the value ofuseStateAdditional information
Final checks