You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+8-31Lines changed: 8 additions & 31 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,8 +13,7 @@ A lightweight, composable and explicit reactivity system.
13
13
14
14
## Features
15
15
16
-
<details>
17
-
<summary>⚡ Plain reactivity. No proxies, no magic.</summary>
16
+
### ⚡ Plain reactivity. No proxies, no magic.
18
17
19
18
It does not convert the value with `Object.defineProperty` nor `Proxy`. Keeping everything as plain JavaScript value makes it easier to work with other libraries and easier for the JavaScript engine to optimize.
<summary>🔍 Explicit reactivity. No hidden dependencies, no surprises.</summary>
30
+
### 🔍 Explicit reactivity. No hidden dependencies, no surprises.
35
31
36
32
Unlike signal-based libraries, `@embra/reactivity` does not automatically track dependencies. You explicitly define what to watch and how to react to changes. This is easier to reason about dependencies and also reduce the cost of complex implicit dependency calculation.
In practice, one of the biggest problems we face with reactivity libraries is the lifecycle management of reactive values. `@embra/reactivity` provides a zero-cost ownership model that allows you to create reactive values with explicit ownership.
70
63
@@ -93,14 +86,11 @@ setCount(1);
93
86
count2$.set(2);
94
87
```
95
88
96
-
</details>
97
-
98
-
<details>
99
-
<summary>🧩 Flexible abstractions of state and actions.</summary>
89
+
### 🧩 Flexible abstractions of state and actions.
100
90
101
91
In the days of Flux reducer model, we often used a single store to hold the state and actions to mutate the state. This was nice for reasoning about the state, but it also introduced a lot of boilerplate code.
102
92
103
-
Later on, a pattern with state and action glued together was introduced, like `redux-actions`. `@embra/reactivity` takes this a step further by providing a more simple and flexible abstraction of state and actions.
93
+
Later on, a pattern with state and action glued together was introduced, like `redux-actions`. `@embra/reactivity` takes this a step further by providing a simple and flexible abstraction of state and actions.
104
94
105
95
In the following example, we create a Writable `count$` which looks like a `Writable<number>`, but internally it is derived from a larger application state `appState$`. This allows other modules to depend on a `Writable<number>` without knowing the details of the application state.
106
96
@@ -122,10 +112,7 @@ const count$ = toWritable(
122
112
trace(count$);
123
113
```
124
114
125
-
</details>
126
-
127
-
<details>
128
-
<summary>⏳ Scheduler mechanism for controlled updates.</summary>
115
+
### ⏳ Scheduler mechanism for controlled updates.
129
116
130
117
`@embra/reactivity` includes a scheduler mechanism and built-in schedulers that lets you control when reactive updates are processed.
131
118
This is useful for batching updates and deferring computations.
<summary>🏗️ Framework agnostic. First-class support for React.</summary>
143
+
### 🏗️ Framework agnostic. First-class support for React.
160
144
161
145
`@embra/reactivity` is designed to be framework agnostic. It can be used with any framework or library that supports JavaScript. It also provides first-class support for React.
162
146
@@ -180,23 +164,16 @@ function Counter({ count$ }) {
180
164
}
181
165
```
182
166
183
-
</details>
184
-
185
-
<details>
186
-
<summary>📦 Small bundle size. Focused on performance and simplicity.</summary>
167
+
### 📦 Small bundle size. Focused on performance and simplicity.
0 commit comments