Skip to content

Installation

IC Reactor is compatible with React 18+, and works with TypeScript 5+.

  • Node.js 18 or later
  • A package manager: npm, yarn, pnpm, or bun

Most users will want the React package, which includes everything you need:

Terminal window
pnpm add @ic-reactor/react @icp-sdk/core @tanstack/react-query

Non-React Projects (Node.js, Svelte, Vue, etc.)

Section titled “Non-React Projects (Node.js, Svelte, Vue, etc.)”

If you’re not using React, install the core package directly:

Terminal window
pnpm add @ic-reactor/core @icp-sdk/core @tanstack/query-core
PackagePurposeFor ReactFor Non-React
@ic-reactor/reactReact hooks + re-exports core
@ic-reactor/coreCore: Reactor, ClientManager, utilitiesincluded
@icp-sdk/coreIC SDK for agents and Candid
@tanstack/react-queryTanStack Query for React
@tanstack/query-coreTanStack Query core (caching engine)included
@icp-sdk/authInternet Identity authenticationOptionalOptional

✅ Requiredincluded means it comes with the parent package • Optional for specific features

IC Reactor is written in TypeScript and provides first-class type support. Ensure your tsconfig.json includes:

{
"compilerOptions": {
"strict": true,
"moduleResolution": "bundler",
"esModuleInterop": true,
"skipLibCheck": true,
"target": "ES2020",
"lib": ["ES2020", "DOM", "DOM.Iterable"]
}
}

If you have a DFX project, generate TypeScript declarations from your Candid files:

Terminal window
dfx generate

This creates TypeScript declarations in src/declarations/<canister_name>/ that IC Reactor uses for type safety. The generated files include:

  • index.js — IDL factory and canister ID
  • <canister>.did.d.ts — TypeScript types for your canister interface

Create a simple test to verify everything is working:

import { ClientManager, Reactor } from "@ic-reactor/react"
import { QueryClient } from "@tanstack/react-query"
const queryClient = new QueryClient()
const clientManager = new ClientManager({ queryClient })
console.log("IC Reactor installed successfully!")
console.log("Network:", clientManager.network)

No additional configuration needed for Vite. Just ensure you have the required polyfills:

vite.config.ts
import { defineConfig } from "vite"
export default defineConfig({
define: {
global: "globalThis",
},
optimizeDeps: {
esbuildOptions: {
define: {
global: "globalThis",
},
},
},
})

For Next.js apps, add to next.config.js:

/** @type {import('next').NextConfig} */
const nextConfig = {
webpack: (config) => {
config.resolve.fallback = {
...config.resolve.fallback,
fs: false,
net: false,
tls: false,
}
return config
},
}
module.exports = nextConfig

Now that you have IC Reactor installed, continue to the Quick Start guide to build your first integration!