handling loading and error states
Hi guys, I'm not sure what's the best way to handle loading and error states for a public website. I was thinking of using QueryBoundaries but I'm not sure because:
- i dont wanna show a Big Spinner in most of the pages.
- I need the queries to run asap and avoid loading states (for seo purposes we dont want to show spinners everywhere)
- I need to catch the errors locally(If a component that makes a request throws error, I dont wanna show a whole error component size of the screen)
As summary, the website is public (kinda amazon)
What's the best way to handle loading/error States ?
Using prefetching ?
Using loaders ? (We are using tanstack router)
Using suspended queries?
2 Replies
quickest-silverOP•12mo ago
Any ideas?
solid-orange•12mo ago
if you use tanstack router, do what's in the docs: route loaders + suspense
https://tanstack.com/router/v1/docs/framework/react/examples/basic-react-query-file-based
TanStack | High Quality Open-Source Software for Web Developers
Headless, type-safe, powerful utilities for complex workflows like Data Management, Data Visualization, Charts, Tables, and UI Components.
