- Date library
- Dayjs
- Moment.js
- Luxon
- Query Engine
- Axios
- Apollo Client
- Tanstack Query
- Frontend
- Rechart
- NextJs App Router Wizard
- Google analytics
- Utility
- Lodash
- Regex
- Commander
- Docker compose
- Shell
React , NextJs, NodeJs , Flutter dev company base in Thailand
Tanstack Query Online playground
Learn how to configure Tanstack Query with various options using the Online Playground, offering hands-on practice and customization.
Parameters
Network Mode
TanStack Query provides three different network modes to distinguish how Queries and Mutations should behave if you have no network connection. This mode can be set for each Query / Mutation individually, or globally via the query / mutation defaults.
Documentonline
Queries and Mutations will not fire unless you have network connection
always
TanStack Query will always fetch and ignore the online / offline state. This is likely the mode you want to choose if you use TanStack Query in an environment where you don't need an active network connection for your Queries to work
offlineFirst
TanStack Query will run the queryFn once, but then pause retries.
Stale Time
The time in milliseconds after data is considered stale.,If set to `Infinity`, the data will never be considered stale.
Retry
Enabled or disable retry (Default true).
Yes
No
Max Retry
Failed queries will retry until the failed query count meets that number
Refetch Interval
If set to a number, the query will continuously refetch at this frequency in milliseconds.
Refetch Interval In Background
If set to `true`, the query will continue to refetch while their tab/window is in the background. Defaults to `false`.
Yes
No
Refetch On Window Focus
Refetch on user refocus on windows. true`: the query will refetch on window focus if the data is stale. `false`: the query will not refetch on window focus. `always`: the query will always refetch on window focus.
true
true
false
false
always
always
Refetch On Reconnect
Refetch when network is coming back
true
true
false
false
always
always
Refetch On Mount
Refetch when component is mounted
true
true
false
false
always
always
Retry On Mount
If set to false, the query will not be retried on mount if it contains an error. Defaults to true.
Yes
No
Throw On Error
If the query errors, the error will only be logged. If you want an error to be thrown, pass the throwOnError: true option
Yes
No
Yes
No
index.ts
Sharing / Save
Copy the link to easily share it with friends, or save the result to revisit and use it later at your convenience.
Copy link
Save
Tanstack Query blogs
Knowledge / tutorial / howto about Tanstack Query
- Testing React Query Components: A Guide Learn how to effectively test React components that use React Query, including setup, mocking responses, and handling different states. Master the best practices for reliable testing.
- Error Handling and Retries in React Query Guide Master error handling and retry mechanisms in React Query. Learn how to implement robust error handling strategies, configure retry logic, and create resilient React applications.
- React Query Best Practices for Performance Discover essential React Query best practices for optimizing your application's performance. Learn about query keys, cache management, prefetching, and advanced techniques for faster apps.
- Managing Dependent Queries in React Query Learn how to effectively handle dependent queries in React Query, from basic implementation to advanced optimization techniques. Master the art of sequential data fetching in React applications.
- Optimistic Updates with React Query: A Practical Guide Learn how to implement optimistic updates in React applications using React Query. Discover best practices, real-world examples, and tips for creating smoother user experiences with instant feedback.
- React Query: Master Pagination & Infinite Scroll Learn how to implement efficient pagination and infinite scrolling in React applications using React Query. Discover best practices, code examples, and pro tips for better UX.
- React Query vs Redux: Essential Guide for Devs Discover when to use React Query vs Redux in your applications. Learn the key differences, use cases, and how to combine both tools for optimal state management in React apps.
- Real-Time Data Handling with React Query Guide Master real-time data handling in React applications using React Query. Learn about automatic background updates, smart caching strategies, and optimistic updates for building responsive apps.
- Top 5 Features of React Query Every Developer Discover the essential features of React Query that will revolutionize your React applications. Learn about automatic refetching, caching, parallel queries, optimistic updates, and infinite queries.
- Introduction to React Query: State Management Discover how React Query revolutionizes state management in React applications. Learn about automatic data synchronization, smart caching, and simplified API handling for better developer experience.