T
TanStack3y ago
useful-bronze

tanstack router inside React router

I’ve added a micro application using tanstack router inside a larger React router project. The initial loading works fine, but afterwards the routing inside tamarack router is not affected by the actions taken in the app wrapping tan stack router. Does anyone have any idea on how to make tanstack router and react router work together? Or is my best bet converting the whole thing to tanstack (will be a large refactor)?
8 Replies
national-gold
national-gold3y ago
This is a goal for the library, so I'll make it possible Can you link to a minimal repro? If not, I'll figure it out either way Just pushed a new version It should accurately listen to other history events now try it out!
useful-bronze
useful-bronzeOP3y ago
Perfect, thanks! I’ll test the latest version. If it doesn’t work I’ll create I minimal repo. Thanks for all the great work, it has made it so much easier to use the platform and avoid unnecessary local state
national-gold
national-gold3y ago
🎉
genetic-orange
genetic-orange3y ago
Actually, tanstack router didn't listen to my React Router v5 history events either but I thought that it's expected. Will try latest version too 🙂
national-gold
national-gold3y ago
It now monkey patches history.pushState and history.replaceState when in use and can now respond to updates coming from other tools using those APIs, So even if you history.pushState your self, it will respond!
useful-bronze
useful-bronzeOP3y ago
It worked like a charm 🎉
national-gold
national-gold3y ago
Woo!!
extended-salmon
extended-salmon2y ago
Is there some sort of demo of how this was done? I'm trying to achieve something similar, but can't figure out how to get the context, providers, double-router and Link's "outside of router" to work. Many issues, this is the only thread I can find that did something I'm trying to achieve

Did you find this page helpful?