安装
AutoStore共包括4个包:
autostore: 核心包@autostorejs/react: 面向React开发者@autostorejs/devtools: 使用Redux DevTools调试AutoStore@autostorejs/syncr: 远程同步两个AutoStore
autostore
autostore是核心包,提供了AutoStore的核心功能。
如果你是Vue等其他框架的开发者,可以直接使用autostore。
该包使用new AutoStore来创建AutoStore实例。
bash
npm install autostorebash
yarn add autostorebash
pnpm add autostore@autostorejs/react
提示
如果您是React开发者,只需要安装@autostorejs/react即可。
- 默认情况下,
@autostorejs/react已经集成了autostore包的所有功能,不需要额外安装autostore。 @autostorejs/react也提供了将autostore包作为peerDependencies的产物,通过import {...} from "@autostorejs/react/lite"方式进行导入。
bash
npm install @autostorejs/reactbash
yarn add @autostorejs/reactbash
pnpm add @autostorejs/react@autostorejs/devtools
@autostorejs/devtools是AutoStore的调试工具包,基于chrome的Redux DevTools Extension来调试AutoStore的状态。
bash
npm install @autostorejs/devtoolsbash
yarn add @autostorejs/devtoolsbash
pnpm add @autostorejs/devtools@autostorejs/syncer
用来远程同步两个AutoStore的数据,如在同步browser和worker的AutoStore数据。
@autostorejs/vue
目前还没有实现,可以通过封装autostore实现Vue的集成。
@autostorejs/react也仅是autostore的封装,代码量很少,有兴趣的同学可以尝试一下。