IC-Reactor:一套用于互联网计算机平台无缝前端开发的JavaScript库,提供状态管理、React集成及核心功能,实现高效......
概览
TypeScript 和 React 的类型安全互联网计算机集成 IC Reactor 是一个用于构建互联网计算机(ICP)应用的单一仓库,支持以下功能: - 端到端TypeScript类型 - 基于TanStack Query的缓存和重取 - React钩子工厂(useActorQuery、useActorMutation等) - 友好显示的变换(DisplayReactor) - 可选代码生成(CLI + Vite插件) IC Reactor 为你提供了比原始 Actor 使用更高级的 API,同时保持了类型的安全性和控制: - 类型化的容器方法调用 - 内置缓存键和失效原语 - 类型化的 Ok/Err 结果处理 - 共享代理 + 通过 ClientManager 管理缓存,互联网身份在 AuthenticationManager 中 - 可重复使用的查询/变异对象,既能在 React 内部也在外部工作 每个软件包的变化都在 CHANGELOG.md,包括主版上尚未发布的改动。
概述(AI 翻译)
TypeScript 和 React 的类型安全互联网计算机集成
IC Reactor 是一个用于构建互联网计算机(ICP)应用的单一仓库,支持以下功能:
- 端到端TypeScript类型
- 基于TanStack查询的缓存和重取
- 反应钩子工厂(
useActorQuery、useActorMutation等) - 显示友好型变换(
DisplayReactor) - 可选代码生成(CLI + Vite 插件)
为什么选择IC反应堆
IC Reactor 为你提供了比原始 Actor 使用更高级的 API,同时保持类型安全和控制:
- 类型化的罐式方法调用
- 内置缓存键和失效原语
- 类型化
Ok/Err结果处理 - 通过
ClientManager实现共享代理+缓存管理,互联网身份代码在AuthenticationManager - 可重复使用、可在 React 内外工作的查询/变异对象
套餐概述
| 包裹 | 目的 |
|---|---|
@ic-reactor/core |
核心运行时(ClientManager、Reactor、DisplayReactor,缓存集成) |
@ic-reactor/react |
React 钩子 + 查询/变异工厂 |
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
IC Reactor
ic-reactor 4 is the current release. It is a thin layer over a candid-core generated module, with a guide shipped in
@ic-reactor/core(packages/core/llms.txt), and it replaced the 3.x runtime of@ic-reactor/coreand@ic-reactor/reactwith the 4 API. The 3.x line lives on thev3branch, takes security fixes only, until 90 days after the 4.0 release, and is documented at ic-reactor.b3pay.net/v3.
IC Reactor is a monorepo of libraries for building Internet Computer (ICP) apps
in TypeScript. ic-reactor 4 adds, over the module candid-core-cli gen writes
for a canister:
- a client with caller-scoped query keys, for TanStack Query
- one error union that says whether a failed call may have executed
- network resolution: mainnet, a local replica, or the
ic_envcookie - strict token-unit helpers (
parseUnits,formatUnits) - a test client over a fake replica
'use client'React bindings: a provider,useClientanduseAuth
Package Overview
| Package | Purpose |
|---|---|
@ic-reactor/core |
The client, errors, network and units |
@ic-reactor/react |
'use client' bindings over core |
@ic-reactor/vite-plugin |
Generates the candid-core module with candid-core-cli gen in a child process, and sets the local ic_env cookie and /api proxy for vite dev |
@ic-reactor/parser, @ic-reactor/codegen and @ic-reactor/cli are not part
of ic-reactor 4: candid-core-cli gen generates the canister module instead.
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add b3pay/ic-reactor