@tinkered/react 0.25.0 → 0.25.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/package.json +3 -3
- package/skills/react/SKILL.md +35 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tinkered/react",
|
|
3
|
-
"version": "0.25.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "Tinkered React: a thin React adapter over @tinkered/core.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"tanstack-intent"
|
|
@@ -29,12 +29,12 @@
|
|
|
29
29
|
"access": "public"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@tinkered/core": "^0.25.
|
|
32
|
+
"@tinkered/core": "^0.25.1"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"@stryker-mutator/core": "^10.0.0",
|
|
36
36
|
"@stryker-mutator/vitest-runner": "^10.0.0",
|
|
37
|
-
"@tinkered/core": "^0.25.
|
|
37
|
+
"@tinkered/core": "^0.25.1",
|
|
38
38
|
"@types/node": "^26.1.1",
|
|
39
39
|
"@types/react": "^19",
|
|
40
40
|
"@types/react-dom": "^19",
|
package/skills/react/SKILL.md
CHANGED
|
@@ -5,8 +5,8 @@ description: >
|
|
|
5
5
|
component in a Tinker app: read a cell, run
|
|
6
6
|
an operation from a button, show a pending or
|
|
7
7
|
failed call, or mount the app. Also when a
|
|
8
|
-
check prints tinker/react-state
|
|
9
|
-
tinker/one-wire.
|
|
8
|
+
check prints tinker/react-state,
|
|
9
|
+
tinker/one-wire or tinker/keyed-prop.
|
|
10
10
|
metadata:
|
|
11
11
|
purpose: >
|
|
12
12
|
How React reads cells and runs operations
|
|
@@ -15,7 +15,7 @@ metadata:
|
|
|
15
15
|
type: framework
|
|
16
16
|
framework: react
|
|
17
17
|
library: '@tinkered/react'
|
|
18
|
-
library_version: '0.25.
|
|
18
|
+
library_version: '0.25.1'
|
|
19
19
|
requires:
|
|
20
20
|
- '@tinkered/core#core'
|
|
21
21
|
sources:
|
|
@@ -110,6 +110,23 @@ const one = useData(
|
|
|
110
110
|
);
|
|
111
111
|
```
|
|
112
112
|
|
|
113
|
+
A list item reads its own member by key. The
|
|
114
|
+
list passes the key, never the member:
|
|
115
|
+
|
|
116
|
+
```tsx no-check
|
|
117
|
+
{list.map((wave) => (
|
|
118
|
+
<Wave key={wave.id} room={room} id={wave.id} />
|
|
119
|
+
))}
|
|
120
|
+
|
|
121
|
+
function Wave({ room, id }: WaveProps) {
|
|
122
|
+
const wave = useData(sea.board.waves.of({ room, id }));
|
|
123
|
+
// ...
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
A write to one member then draws that item
|
|
128
|
+
alone.
|
|
129
|
+
|
|
113
130
|
### A computed value with a stable reference
|
|
114
131
|
|
|
115
132
|
Use a Core `derived`, not `useMemo`. Pass its
|
|
@@ -187,6 +204,19 @@ Right: a `resource` holds the timer and its
|
|
|
187
204
|
cleanup. An operation or a capsule `start` hook
|
|
188
205
|
depends on it.
|
|
189
206
|
|
|
207
|
+
### HIGH: a member passed as a prop [tinker/keyed-prop]
|
|
208
|
+
|
|
209
|
+
Wrong:
|
|
210
|
+
|
|
211
|
+
```tsx no-check
|
|
212
|
+
{list.map((wave) => <Wave wave={wave} />)}
|
|
213
|
+
<Lanes list={list} />
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
Right: pass the key. The child reads
|
|
217
|
+
`useData(part.of(key))`, or `part.where(key)`
|
|
218
|
+
for a list.
|
|
219
|
+
|
|
190
220
|
### HIGH: `fetch` in a component [tinker/one-wire]
|
|
191
221
|
|
|
192
222
|
The page talks to the server by rpc and remote
|
|
@@ -206,6 +236,7 @@ third argument.
|
|
|
206
236
|
## Completion
|
|
207
237
|
|
|
208
238
|
- The app's frontend check prints no
|
|
209
|
-
`tinker/react-state
|
|
239
|
+
`tinker/react-state`, `tinker/one-wire` or
|
|
240
|
+
`tinker/keyed-prop`.
|
|
210
241
|
- A browser test clicks the control and reads
|
|
211
242
|
the new text.
|