# IC Reactor 4

ic-reactor 4 is a thin layer over a module that `candid-core-cli gen`
generates from a `.did` file. The layer is a client with caller-scoped query
keys, one error type that says whether a call may have executed, helpers for
token units, a test client over an in-memory replica, and a React provider
with `useAuth`. Reading and writing use TanStack Query's own hooks.

```ts
import { createClient } from "@ic-reactor/core"
import { actor, type Actor } from "./generated/icrc1"

const client = createClient({ network: "ic", identity: "anonymous" })
const ledger = client.canister<Actor>(actor, {
  id: "ryjl3-tyaaa-aaaaa-aaaba-cai",
})

console.log(await ledger.icrc1_symbol()) // "ICP"
```

## Status

ic-reactor 4 is a prerelease. Its betas are published under npm's `beta`
dist-tag, and `latest` is still 3.x until 4.0 GA. Install it as
`@ic-reactor/core@beta`, never bare. The code is developed on the
[`v4` branch](https://github.com/B3Pay/ic-reactor/tree/v4).

These pages describe what is built on `v4` and nothing else. The one guide
that ships in the package, `node_modules/@ic-reactor/core/llms.txt`, is for
people and coding agents alike, and these pages agree with it.

Coming from 3.x? Start with [Migrating from 3.x](https://ic-reactor.b3pay.net/v4/migrating-from-3/): the
3.x names are gone, and that page maps each one to its 4 replacement.

## Start here

[Getting started](https://ic-reactor.b3pay.net/v4/guides/getting-started/)
  [Examples](https://ic-reactor.b3pay.net/v4/examples/)
  [Migrating from 3.x](https://ic-reactor.b3pay.net/v4/migrating-from-3/)
## Guides

In reading order.

[The client](https://ic-reactor.b3pay.net/v4/guides/client/)
  [Values and units](https://ic-reactor.b3pay.net/v4/guides/values/)
  [Reads](https://ic-reactor.b3pay.net/v4/guides/reads/)
  [Writes](https://ic-reactor.b3pay.net/v4/guides/writes/)
  [Errors and mayHaveExecuted](https://ic-reactor.b3pay.net/v4/guides/errors/)
  [Auth](https://ic-reactor.b3pay.net/v4/guides/auth/)
  [SSR and hydration](https://ic-reactor.b3pay.net/v4/guides/ssr/)
  [Testing](https://ic-reactor.b3pay.net/v4/guides/testing/)
  [The Vite plugin](https://ic-reactor.b3pay.net/v4/guides/vite-plugin/)
## Packages

[@ic-reactor/core](https://ic-reactor.b3pay.net/v4/packages/core/)
  [@ic-reactor/react](https://ic-reactor.b3pay.net/v4/packages/react/)
  [@ic-reactor/vite-plugin](https://ic-reactor.b3pay.net/v4/packages/vite-plugin/)
The API reference in the sidebar is generated from the `v4` branch as it
stands.