Installation
Add Effetch Query to a project, with Effetch, Effect and React.
Effetch Query is one package. You add it beside Effect, and beside Effetch, React and your router if you use them. This page shows the command for each.
Before you begin
You need:
effect4.1 or later, which is a peer dependency;- an ESM project, since the package is ESM only;
- one of the supported runtimes: browsers, React Native (Hermes), Node 20 or later, Bun or Deno.
Install the package
To install Effetch Query with Effetch and Effect, run the following command:
pnpm add @monarcode/effetch-query @monarcode/effetch effectIf you use Effetch, you need 0.1.0-rc.4 or later in 0.1. You import it
as import { Fetch } from "@monarcode/effetch". Effetch is optional: to
use any Effect instead, see
Queries from any Effect.
Add React
For React, add @effect/atom-react 4.1 or later and react 19:
pnpm add @effect/atom-react reactAdd TanStack Router
To connect a client to TanStack Router or TanStack Start, add
@tanstack/react-router 1.170.33 or later in 1.x:
pnpm add @tanstack/react-routerTanStack Router and Start shows the setup.
Add React Native's signals
In React Native, the client hears that the app came back into focus or
online from React Native's AppState and NetInfo. Effetch Query doesn't
depend on either: you pass them in. Add NetInfo if your app doesn't have
it:
pnpm add @react-native-community/netinfoReact Native shows the setup.
Import the entry points
Each entry point is a subpath of the one package, such as
@monarcode/effetch-query/react, so you import only what you use. The core
entry point exports namespaces:
import { , , } from "@monarcode/effetch-query";If this line compiles, the package is installed. Entry points lists every entry point and what it exports.
What's next
- Getting started: build a small todo app, end to end.
- Coming from TanStack Query: if you know TanStack Query, the same ideas under their names here.