A TanStack Start example demonstrating integration with Effect Atom.
To start a new project based on this example, run:
npx gitpick carloitaben/effect-atom-tanstack-router/tree/main/examples/react start-basic-effect-atom-reactFrom your terminal:
pnpm install
pnpm devThis starts your app in development mode, rebuilding assets on file changes.
In development, the root route mounts a single unified TanStack Devtools shell with both the Router pane and an Effect Atom pane:
import { TanStackDevtools } from "@tanstack/react-devtools";
import { TanStackRouterDevtoolsPanel } from "@tanstack/react-router-devtools";
import { createAtomDevtoolsPlugin } from "effect-atom-tanstack-devtools/react";
import * as React from "react";
const plugins = React.useMemo(
() => [
{ name: "TanStack Router", render: <TanStackRouterDevtoolsPanel /> },
createAtomDevtoolsPlugin({ registry }),
],
[registry],
);
{
import.meta.env.DEV && <TanStackDevtools plugins={plugins} />;
}Open the devtools trigger and choose Effect Atom to inspect the router's atom registry, or TanStack Router for the router pane. There is no separate Router or Atom floating shell.
The Atom pane and plugin are no-ops outside development on their own. The
import.meta.env.DEV branch only keeps the unified shell out of the production
bundle, because @tanstack/react-devtools does not strip its own shell.
Sampling never initializes an atom or keeps one alive. The pane's only write is an explicit, confirmed Reset registry action.
To build the app for production:
pnpm buildThis example demonstrates how to use TanStack Query with TanStack Start for:
- Server-side data fetching
- Client-side caching and synchronization
- Optimistic updates
- Automatic refetching