Next.js Integration
This example shows how to use IC Reactor in an existing Next.js app that still
uses dfx for local deployment and declaration generation.
Features Demonstrated
Section titled “Features Demonstrated”- Next.js Pages Router: The app lives under
src/pages, not the App Router. - Rust Backend: A local canister under
backend/. - Manual declaration flow:
dfx generateoutput is committed undersrc/declarations/todo/. - IC Reactor hooks:
createActorHookswraps aReactorbuilt from those generated declarations.
Open in StackBlitz Edit and inspect the example
View on GitHub Browse the source code
Setup Guide
Section titled “Setup Guide”cd examples/nextjsnpm run install:allnpm run dfx:startnpm run deploynpm run generatenpm run devKey Integration
Section titled “Key Integration”export const clientManager = new ClientManager({ queryClient, withProcessEnv: true, agentOptions: { verifyQuerySignatures: false, },})export const todoReactor = new Reactor<_SERVICE>({ name: "todo", clientManager, canisterId, idlFactory,})
export const { useActorQuery: useQueryTodo, useActorMutation: useMutateTodo } = createActorHooks(todoReactor)