T
TanStack15mo ago
other-emerald

How to test a custom hook that uses tanstack router?!??

If you have a custom hook that needs some tanstack router state its really hard to test since the normal renderHooks with tanstack is not rendering correctly - at least not when testing rerenders. We do alot of custom hooks and write simple rerender tests for them to ensure they dont do state changes between rerenders - but it seems Matches.tsx is recreating the hooks on first rerender... I had issues create a simple test to prove it works - can someone help figure out what to do about it --> https://github.com/TanStack/router/pull/1822
GitHub
Added test to prove rerender test for hooks is not possible right n...
If you create any hook that relies on a tanstack router hook - it becomes hard to test since the rerender recreates the elements again, I traced it down to this part in matches.tsx const ResolvedS...
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?