I'm working on a client-side single-page application (SPA) for a dashboard, and I'm considering adding server-side rendering (SSR) capabilities in the future. After five years of using React, I'm looking to switch to SolidJs since I'm not a fan of React hooks. I want to use Tanstack Query for data fetching, but I'm curious if anyone has had good experiences with combining SolidJs and Tanstack Query.
4 Answers
I've been using Solid with Tanstack Query for about six months, and honestly, it's been a smooth experience! The reactive primitives in Solid mesh really well with Tanstack's query management. One thing to note is that Solid's reactivity is more granular than React's, so you might use `createMemo` less often than you'd think—queries tend to run smoothly without much setup. If you're considering SSR later, be aware that Solidstart offers nice support for Tanstack Query. Just take some time to configure your query client thoroughly for hydration, as the documentation isn’t as robust as Next.js. The best part? Without all those `useEffect` chains, the code feels much cleaner. Are you planning to start with Solidstart right away, or add it in later? That might affect your current setup.
I've dabbled with that setup, and surprisingly, it feels very clean once you adjust your mindset. Solid’s reactivity clears away a lot of the boilerplate, making TanStack Query blend seamlessly into the background. The tricky part was just retraining how I thought about updates.
If you're thinking about SSR later, definitely check out Tanstack Start or even the new Solid 2.0 createAsync primitives. Solid’s hydration process is more lightweight compared to React since it doesn't require rebuilding a virtual DOM on the client. Combining Tanstack Query with Solid’s fine-grained updates should give your dashboard a smaller JavaScript bundle, plus better performance scores out of the box.
I haven't used TanStack Query with SolidJs in a production setting yet, but I've played around with SolidJs and found its reactivity model to be much easier to work with compared to React. From what I've seen, TanStack Query should function well with Solid thanks to its adapter. Just keep an eye on how caching interacts with reactivity; since Solid doesn’t re-render like React, signals become more important. For an initial client-side dashboard, Solid and TanStack Query should work nicely together. However, if you plan to implement SSR later, I'd recommend testing out hydration and caching behaviors early on, as those tend to present some tricky edge cases.

Yeah, I was planning to start using Tanstack Start for Solid from day one. Thanks for your insights! I just realized Tanstack Start for SolidJs and Solid Start are not the same thing.