I have the following urls /overview and /overview/$singleID where the main page is a table of content and if you click on something I want to show a modal.
Right now I've solved this with an <Outlet /> and it works great. But since I can't pass data down to the Outlet I need to load data twice. I could obviously solve this using a context but this feels overkill.
What's the best way to have two routes load the same view? I could control the modal based on if $singleID is set or not. But how would I then have both /overview and /overview/$singleID load the same component?
#Show optional modal based on route without loading additional data
4 messages · Page 1 of 1 (latest)
If you're using tanstack-query, you could just get the data you need from the cache.
Otherwise I think you can't do it properly without a context, sadly.
Yeah sorry, should have mentioned how I fetch data. I'm using Apollo. So cache would solve the problem as well. I was mostly curious about if there were a better way of doing it.
I had the same "problem" and search for a solution but didn't found one. I don't think it exists a better approach