|
| 1 | +--- |
| 2 | +title: SolidJS and Propagator Model |
| 3 | +date: 2024-09-16 |
| 4 | +--- |
| 5 | + |
| 6 | +solidjs 很明显就是一个 propagator model, |
| 7 | +可以理解为 cell 保存的东西是 history -- time 到 value 的 k-v-map, |
| 8 | +在前端 view 组件中显示的,只是 history 中最新的 entry。 |
| 9 | + |
| 10 | +下面的描述和 inet 中用表层语言来构造计算模型的对象类似: |
| 11 | + |
| 12 | +> Components have a lifecycle that defines how they are created, |
| 13 | +> updated, and destroyed. A Solid component's lifecycle is different |
| 14 | +> from other frameworks, as it is tied to the concept of reactivity. |
| 15 | +
|
| 16 | +> Where frameworks may re-run components on every state change, a |
| 17 | +> Solid component's lifecycle is tied to its initial run. What this |
| 18 | +> means is that a Solid component is only run once, when it is first |
| 19 | +> rendered into the DOM. After that, the component is not re-run, even |
| 20 | +> if the application's state changes. |
| 21 | +
|
| 22 | +> When the Solid component renders, it sets up a reactive system that |
| 23 | +> monitors for state changes. When a state change occurs, the |
| 24 | +> component will update the relevant areas without re-running the |
| 25 | +> entire component. By bypassing the full component lifecycle on |
| 26 | +> every state change, Solid has a more predictable behavior compared |
| 27 | +> to frameworks that re-run functions on every update. |
| 28 | +
|
| 29 | +但是这里的 "re-run functions on every update" |
| 30 | +还是 expression 思维,或者说是 functional 思维。 |
0 commit comments