Close a modal using the back key, with tanstack-router
I have an app where modals are NOT controlled by url query params. I would like however to be able to close them using the back browser button (for mobile users basically)
In the render function of my modal component, I was considered adding:
Well it works. The modal is closed when I press the back button. But at the same time I see the previous page flashing before coming back to the current one.
Is there any way to block tanstack-router navigation in such a case?
By the way, what's your opinion about modals? Should I use query-params to open them? What are the pro & cons, beyond the back navigation key?
0 Replies