T
TanStack3y ago
equal-aqua

How can I use the URL to open a modal?

Is there a way to change the URL without trigger a new page load? I am trying achieve deep linking within a given component where the UIs will change according to the URL.
2 Replies
absent-sapphire
absent-sapphire3y ago
I've used query params before to be able to show/close a modal. Works well and doesn't cause page load. Essentially just check for the existence of the query param, if there, show the modal, if not don't.
helpful-purple
helpful-purple3y ago
You could also make a child route that just renders a modal when matched and make sure the parent renders <Outlet />

Did you find this page helpful?