0
Fork 0
mirror of https://github.com/TanStack/router.git synced 2026-11-16 19:38:07 +00:00
router/examples/react/start-basic-react-query
github-actions[bot] 6b9fe6d295
ci: Version Packages (#8745)
ci: changeset release

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
History 2026-10-22 22:05:39 +02:00
..
.devcontainer docs: add devcontainer.json to all e2e/examples (#6972) 2026-03-18 15:43:14 +01:00
.vscode chore(examples): add .vscode/settings.json configuration (#3349) 2025-02-07 10:29:48 +13:00
public feat: New Serialization Paradigm (#1824) 2024-06-28 09:45:01 -06:00
src docs(start): add tested TanStack Query integration guide (#8372) 2026-09-11 17:13:58 -06:00
tests docs(start): add tested TanStack Query integration guide (#8372) 2026-09-11 17:13:58 -06:00
.gitignore feat: Merge alpha to main (#4365) 2025-06-10 23:19:32 +02:00
.prettierignore chore(examples): cleanup the deps for the start examples (#2388) 2024-09-21 22:21:59 +12:00
package.json ci: Version Packages (#8745) 2026-10-22 22:05:39 +02:00
playwright.config.ts docs(start): add tested TanStack Query integration guide (#8372) 2026-09-11 17:13:58 -06:00
README.md docs(start): add tested TanStack Query integration guide (#8372) 2026-09-11 17:13:58 -06:00
tsconfig.json chore: upgrade tooling to typescript 6 (#7024) 2026-03-23 22:59:52 +01:00
vite.config.ts docs: update examples/e2e to vite 8 (#6958) 2026-03-17 20:37:11 +01:00

TanStack Start - Basic React Query Example

A TanStack Start example demonstrating integration with TanStack Query (React Query).

Start a new project based on this example

To start a new project based on this example, run:

npx gitpick TanStack/router/tree/main/examples/react/start-basic-react-query start-basic-react-query

Getting Started

From your terminal:

pnpm install
pnpm dev

This starts your app in development mode, rebuilding assets on file changes.

Build

To build the app for production:

pnpm build

TanStack Query Integration

This example demonstrates how to use TanStack Query with TanStack Start for:

  • Server-side data fetching
  • Client-side caching and synchronization
  • Confirmed server mutations followed by query invalidation
  • Explicit freshness and automatic refetching

SSR and mutation checks

Read the Start + TanStack Query guide. The /preferences page stores a harmless display name in a cookie, so its tests need no account or external API. This cookie is not authentication. The other post/user examples use JSONPlaceholder.

pnpm exec playwright install chromium
pnpm test:e2e
pnpm build
QUERY_EXAMPLE_PRODUCTION=1 pnpm test:e2e

The tests check concurrent SSR request isolation, no duplicate hydration read, one refetch after mutation invalidation, and persistence on reload. Query data is fresh for 30 seconds by default in this example; choose a window appropriate for your application.