@formvk/reactive-react 1.0.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # Change Log
2
+
3
+ All notable changes to this project will be documented in this file.
4
+ See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
+
6
+ ## [1.1.1](https://github.com/formvk/core/compare/v1.1.0...v1.1.1) (2026-11-17)
7
+
8
+ **Note:** Version bump only for package @formvk/reactive-react
9
+
10
+ # [1.1.0](https://github.com/formvk/core/compare/v1.0.0...v1.1.0) (2026-11-16)
11
+
12
+ ### Features
13
+
14
+ - 为所有包添加中英双语 README 文件并导出 reactive-react 包 ([22f7b77](https://github.com/formvk/core/commit/22f7b7751e636d4aa8fbc844ec9b286414d4a14f))
15
+
1
16
  # @formvk/reactive-react
2
17
 
3
18
  ## 1.0.0
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @formvk/reactive-react
2
2
 
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
3
5
  React bindings for `@formvk/reactive`. Wrap a component with `observer` and it re-renders whenever observable data read during render changes.
4
6
 
5
7
  ## Install
@@ -0,0 +1,56 @@
1
+ # @formvk/reactive-react
2
+
3
+ [English](./README.md) | [简体中文](./README.zh-CN.md)
4
+
5
+ `@formvk/reactive` 的 React 绑定。用 `observer` 包裹组件后,组件在渲染期间读取的可观察数据发生变化时会自动重新渲染。
6
+
7
+ ## 安装
8
+
9
+ ```bash
10
+ pnpm add @formvk/reactive-react
11
+ ```
12
+
13
+ `react` 与 `react-dom`(`>= 18`)是 peer 依赖。
14
+
15
+ ## 使用
16
+
17
+ ```tsx
18
+ import { observable } from '@formvk/reactive'
19
+ import { observer } from '@formvk/reactive-react'
20
+
21
+ const state = observable({ count: 0 })
22
+
23
+ export const Counter = observer(() => <button onClick={() => (state.count += 1)}>count: {state.count}</button>)
24
+ ```
25
+
26
+ 用于局部订阅的 render-prop 形式:
27
+
28
+ ```tsx
29
+ import { Observer } from '@formvk/reactive-react'
30
+
31
+ function Count() {
32
+ return <Observer>{() => <span>{state.count}</span>}</Observer>
33
+ }
34
+ ```
35
+
36
+ `observer` 支持 `{ forwardRef, displayName, scheduler }` 选项:
37
+
38
+ ```tsx
39
+ const Input = observer(MyInput, { forwardRef: true, displayName: 'Input' })
40
+ ```
41
+
42
+ ## API
43
+
44
+ - `observer(Component, options?)` — 带缓存的包装器,追踪可观察读取并触发重渲染。
45
+ - `Observer` — 以 render prop 作为 `children` 的组件。
46
+ - `useObserver(view, options?)` — 在 observer 的追踪上下文中执行渲染函数。
47
+ - `useForceUpdate()` — 强制重新渲染。
48
+ - 类型 — `IObserverOptions`、`IObserverProps`、`ReactFC`。
49
+
50
+ ## 文档
51
+
52
+ https://formvk.github.io/core/zh/api/react
53
+
54
+ ## License
55
+
56
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@formvk/reactive-react",
3
- "version": "1.0.0",
3
+ "version": "1.1.1",
4
4
  "description": "Formvk Reactive React Bindings",
5
5
  "keywords": [
6
6
  "form",
@@ -20,7 +20,7 @@
20
20
  "module": "dist/index.js",
21
21
  "types": "dist/index.d.ts",
22
22
  "dependencies": {
23
- "@formvk/reactive": "~1.0.0",
23
+ "@formvk/reactive": "~1.1.1",
24
24
  "hoist-non-react-statics": "^3.3.2"
25
25
  },
26
26
  "devDependencies": {