Hi guys,
ive been wondering whats your go to way when you display data in a a SPA. Im currently using custom states mainly to show contact lists, chats and for navigation.
The Downside is that the browser loads, if the states are too large. Thats why im wondering.
When would you use URL Paramter and when would you work with states? Are there any “Rules” where you shouldnt use states or shouldnt use URL Parameter?
for smaller, temporary interactions, custom states are typically the better choice, but for sharable, persistent states, its more appropriate to use URL parameters
2 Likes
I wouldn’t do that
Contact Lists and Chats should just be loaded via a DB search. Navigation is with an option set and should use the URL parameters for setting/retrieving the value
URL parameters as mentioned by @emmanuelkibet168 are good for persistent states, meaning the value is always there so long as the URL parameter value is there, which means it is not lost when the page is reloaded/refreshed like a custom state is…additionally, you can share a URL with URL parameters, which opens features of sending emails with notifications about specific things.
I use custom states for things like on/off or processing to change the way a button looks, or maybe for a subfeature tabbing, so something like looking at different pricing plans
1 Like