TanStack/query — reverse-engineered prompt
Reverse engineered prompt
Build me a TypeScript library for web apps that makes loading data from APIs feel simple and reliable. I want it to handle the annoying parts of server data for me, like caching responses, knowing when data is stale, refetching in the background, retrying failed requests, cancelling requests, and keeping screens in sync after updates.
It should work with normal promises, REST APIs, GraphQL, or whatever fetch function the user gives it. Include a core package that does not depend on a UI framework, then add friendly integrations for React, Vue, Solid, and Svelte. For React, make the main experience hooks for queries, mutations, pagination, infinite scrolling, dependent queries, prefetching, and Suspense.
Please include clear examples and docs that show common app flows like loading a list, viewing details, updating an item, and infinite scroll. Keep the public API clean and predictable, with strong TypeScript types. Look up current docs online if you need to.
Want more depth? Deep Reverse