Maintain state variables when query parameters change

Hello all, I was wondering if there is a way to maintain a state variable when query string parameters are changed. For some context, I have created my own custom modal which displays data based on parts of the query string but want to pass and maintain some state variables when the url changes. Is there a way to do this?

Thanks in advance, Tom

Hello @tom_stove.

States are lost every time the page re-renders. You could try storing relevant values in the localStorage. You can access localStorage with globalThis.localStorage in dynamic expressions. Just be careful that accessing localStorage can cause Server Side Render to not work correctly.

Hi icaro, thanks for that :slight_smile: