@latticexyz/react 2.0.12-main-9be2bb86 → 2.0.12-main-e43c0938

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@latticexyz/react",
3
- "version": "2.0.12-main-9be2bb86",
3
+ "version": "2.0.12-main-e43c0938",
4
4
  "description": "React tools for MUD client.",
5
5
  "repository": {
6
6
  "type": "git",
@@ -12,14 +12,16 @@
12
12
  "exports": {
13
13
  ".": "./dist/index.js"
14
14
  },
15
- "types": "src/index.ts",
15
+ "files": [
16
+ "dist"
17
+ ],
16
18
  "dependencies": {
17
19
  "fast-deep-equal": "^3.1.3",
18
20
  "mobx": "^6.7.0",
19
21
  "react": "^18.2.0",
20
22
  "rxjs": "7.5.5",
21
- "@latticexyz/recs": "2.0.12-main-9be2bb86",
22
- "@latticexyz/store": "2.0.12-main-9be2bb86"
23
+ "@latticexyz/recs": "2.0.12-main-e43c0938",
24
+ "@latticexyz/store": "2.0.12-main-e43c0938"
23
25
  },
24
26
  "devDependencies": {
25
27
  "@testing-library/react-hooks": "^8.0.1",
package/CHANGELOG.md DELETED
@@ -1,529 +0,0 @@
1
- # Change Log
2
-
3
- ## 2.0.12-main-9be2bb86
4
-
5
- ### Patch Changes
6
-
7
- - @latticexyz/recs@2.0.12-main-9be2bb86
8
- - @latticexyz/store@2.0.12-main-9be2bb86
9
-
10
- ## 2.0.11
11
-
12
- ### Patch Changes
13
-
14
- - @latticexyz/recs@2.0.11
15
- - @latticexyz/store@2.0.11
16
-
17
- ## 2.0.10
18
-
19
- ### Patch Changes
20
-
21
- - Updated dependencies [4e4e9104]
22
- - Updated dependencies [32c1cda6]
23
- - Updated dependencies [4caca05e]
24
- - Updated dependencies [27f888c7]
25
- - @latticexyz/store@2.0.10
26
- - @latticexyz/recs@2.0.10
27
-
28
- ## 2.0.9
29
-
30
- ### Patch Changes
31
-
32
- - @latticexyz/store@2.0.9
33
- - @latticexyz/recs@2.0.9
34
-
35
- ## 2.0.8
36
-
37
- ### Patch Changes
38
-
39
- - @latticexyz/store@2.0.8
40
- - @latticexyz/recs@2.0.8
41
-
42
- ## 2.0.7
43
-
44
- ### Patch Changes
45
-
46
- - Updated dependencies [ed404b7d]
47
- - @latticexyz/store@2.0.7
48
- - @latticexyz/recs@2.0.7
49
-
50
- ## 2.0.6
51
-
52
- ### Patch Changes
53
-
54
- - Updated dependencies [103db6ce]
55
- - Updated dependencies [9720b568]
56
- - Updated dependencies [c18e93c5]
57
- - Updated dependencies [d95028a6]
58
- - @latticexyz/store@2.0.6
59
- - @latticexyz/recs@2.0.6
60
-
61
- ## 2.0.5
62
-
63
- ### Patch Changes
64
-
65
- - Updated dependencies [b798ccb2]
66
- - @latticexyz/store@2.0.5
67
- - @latticexyz/recs@2.0.5
68
-
69
- ## 2.0.4
70
-
71
- ### Patch Changes
72
-
73
- - @latticexyz/store@2.0.4
74
- - @latticexyz/recs@2.0.4
75
-
76
- ## 2.0.3
77
-
78
- ### Patch Changes
79
-
80
- - @latticexyz/store@2.0.3
81
- - @latticexyz/recs@2.0.3
82
-
83
- ## 2.0.2
84
-
85
- ### Patch Changes
86
-
87
- - @latticexyz/recs@2.0.2
88
- - @latticexyz/store@2.0.2
89
-
90
- ## 2.0.1
91
-
92
- ### Patch Changes
93
-
94
- - Updated dependencies [4a6b4598]
95
- - @latticexyz/store@2.0.1
96
- - @latticexyz/recs@2.0.1
97
-
98
- ## 2.0.0
99
-
100
- ### Major Changes
101
-
102
- - e3de1a338: Removes `useRow` and `useRows` hooks, previously powered by `store-cache`, which is now deprecated. Please use `recs` and the corresponding `useEntityQuery` and `useComponentValue` hooks. We'll have more hooks soon for SQL.js sync backends.
103
-
104
- ### Minor Changes
105
-
106
- - 939916bcd: Adds a `usePromise` hook that returns a [native `PromiseSettledResult` object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled).
107
-
108
- ```tsx
109
- const promise = fetch(url);
110
- const result = usePromise(promise);
111
-
112
- if (result.status === "idle" || result.status === "pending") {
113
- return <>fetching</>;
114
- }
115
-
116
- if (result.status === "rejected") {
117
- return <>error fetching: {String(result.reason)}</>;
118
- }
119
-
120
- if (result.status === "fulfilled") {
121
- return <>fetch status: {result.value.status}</>;
122
- }
123
- ```
124
-
125
- ### Patch Changes
126
-
127
- - 01e46d99: Removed some unused files, namely `curry` in `@latticexyz/common` and `useDeprecatedComputedValue` from `@latticexyz/react`.
128
- - 590542030: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages.
129
- - 9ef3f9a7c: Fixed an issue where `useComponentValue` would not detect a change and re-render if the component value was immediately removed.
130
- - Updated dependencies [7ce82b6fc]
131
- - Updated dependencies [d8c8f66bf]
132
- - Updated dependencies [c6c13f2ea]
133
- - Updated dependencies [1b86eac05]
134
- - Updated dependencies [a35c05ea9]
135
- - Updated dependencies [c9ee5e4a]
136
- - Updated dependencies [c963b46c7]
137
- - Updated dependencies [05b3e8882]
138
- - Updated dependencies [ce7125a1b]
139
- - Updated dependencies [aea67c580]
140
- - Updated dependencies [07dd6f32c]
141
- - Updated dependencies [c14f8bf1e]
142
- - Updated dependencies [90e4161bb]
143
- - Updated dependencies [aabd30767]
144
- - Updated dependencies [331dbfdcb]
145
- - Updated dependencies [1d60930d6]
146
- - Updated dependencies [f9f9609ef]
147
- - Updated dependencies [904fd7d4e]
148
- - Updated dependencies [e6c03a87a]
149
- - Updated dependencies [1077c7f53]
150
- - Updated dependencies [2c920de7]
151
- - Updated dependencies [b9e562d8f]
152
- - Updated dependencies [44236041f]
153
- - Updated dependencies [759514d8b]
154
- - Updated dependencies [952cd5344]
155
- - Updated dependencies [d5094a242]
156
- - Updated dependencies [a25881160]
157
- - Updated dependencies [c4d5eb4e4]
158
- - Updated dependencies [f62c767e7]
159
- - Updated dependencies [9aa5e786]
160
- - Updated dependencies [de151fec0]
161
- - Updated dependencies [37c228c63]
162
- - Updated dependencies [c991c71a]
163
- - Updated dependencies [ae340b2bf]
164
- - Updated dependencies [1bf2e9087]
165
- - Updated dependencies [211be2a1e]
166
- - Updated dependencies [0f3e2e02b]
167
- - Updated dependencies [d08789282]
168
- - Updated dependencies [5c965a919]
169
- - Updated dependencies [f99e88987]
170
- - Updated dependencies [d5b73b126]
171
- - Updated dependencies [190fdd11]
172
- - Updated dependencies [433078c54]
173
- - Updated dependencies [b2d2aa715]
174
- - Updated dependencies [83583a505]
175
- - Updated dependencies [5e723b90e]
176
- - Updated dependencies [6573e38e9]
177
- - Updated dependencies [afaf2f5ff]
178
- - Updated dependencies [37c228c63]
179
- - Updated dependencies [37c228c63]
180
- - Updated dependencies [44a5432ac]
181
- - Updated dependencies [6e66c5b74]
182
- - Updated dependencies [8d51a0348]
183
- - Updated dependencies [1e2ad78e2]
184
- - Updated dependencies [65c9546c4]
185
- - Updated dependencies [48909d151]
186
- - Updated dependencies [7b28d32e5]
187
- - Updated dependencies [590542030]
188
- - Updated dependencies [48c51b52a]
189
- - Updated dependencies [9f8b84e73]
190
- - Updated dependencies [66cc35a8c]
191
- - Updated dependencies [672d05ca1]
192
- - Updated dependencies [55a05fd7a]
193
- - Updated dependencies [63831a264]
194
- - Updated dependencies [6db95ce15]
195
- - Updated dependencies [8193136a9]
196
- - Updated dependencies [5d737cf2e]
197
- - Updated dependencies [a7b30c79b]
198
- - Updated dependencies [92de59982]
199
- - Updated dependencies [22ee44700]
200
- - Updated dependencies [ad4ac4459]
201
- - Updated dependencies [be313068b]
202
- - Updated dependencies [ac508bf18]
203
- - Updated dependencies [93390d89]
204
- - Updated dependencies [bb91edaa0]
205
- - Updated dependencies [144c0d8d]
206
- - Updated dependencies [5ac4c97f4]
207
- - Updated dependencies [bfcb293d1]
208
- - Updated dependencies [1890f1a06]
209
- - Updated dependencies [e48171741]
210
- - Updated dependencies [9b43029c3]
211
- - Updated dependencies [37c228c63]
212
- - Updated dependencies [55ab88a60]
213
- - Updated dependencies [c58da9ad]
214
- - Updated dependencies [37c228c63]
215
- - Updated dependencies [535229984]
216
- - Updated dependencies [af639a264]
217
- - Updated dependencies [5e723b90e]
218
- - Updated dependencies [99ab9cd6f]
219
- - Updated dependencies [0d12db8c2]
220
- - Updated dependencies [c049c23f4]
221
- - Updated dependencies [80dd6992e]
222
- - Updated dependencies [60cfd089f]
223
- - Updated dependencies [24a6cd536]
224
- - Updated dependencies [37c228c63]
225
- - Updated dependencies [708b49c50]
226
- - Updated dependencies [3ac68ade6]
227
- - Updated dependencies [22ba7b675]
228
- - Updated dependencies [3042f86e]
229
- - Updated dependencies [5e71e1cb5]
230
- - Updated dependencies [d7b1c588a]
231
- - Updated dependencies [5c52bee09]
232
- - Updated dependencies [8025c3505]
233
- - Updated dependencies [745485cda]
234
- - Updated dependencies [afdba793f]
235
- - Updated dependencies [37c228c63]
236
- - Updated dependencies [3e7d83d0]
237
- - Updated dependencies [cea754dde]
238
- - Updated dependencies [cc2c8da00]
239
- - Updated dependencies [252a1852]
240
- - Updated dependencies [103f635eb]
241
- - @latticexyz/store@2.0.0
242
- - @latticexyz/recs@2.0.0
243
-
244
- ## 2.0.0-next.18
245
-
246
- ### Patch Changes
247
-
248
- - 01e46d99: Removed some unused files, namely `curry` in `@latticexyz/common` and `useDeprecatedComputedValue` from `@latticexyz/react`.
249
- - Updated dependencies [c9ee5e4a]
250
- - Updated dependencies [2c920de7]
251
- - Updated dependencies [44236041]
252
- - Updated dependencies [9aa5e786]
253
- - Updated dependencies [c991c71a]
254
- - Updated dependencies [190fdd11]
255
- - Updated dependencies [8193136a9]
256
- - Updated dependencies [93390d89]
257
- - Updated dependencies [144c0d8d]
258
- - Updated dependencies [c58da9ad]
259
- - Updated dependencies [3042f86e]
260
- - Updated dependencies [d7b1c588a]
261
- - Updated dependencies [3e7d83d0]
262
- - Updated dependencies [252a1852]
263
- - @latticexyz/store@2.0.0-next.18
264
- - @latticexyz/recs@2.0.0-next.18
265
-
266
- ## 2.0.0-next.17
267
-
268
- ### Patch Changes
269
-
270
- - Updated dependencies [a35c05ea]
271
- - Updated dependencies [05b3e888]
272
- - Updated dependencies [aabd3076]
273
- - Updated dependencies [55a05fd7]
274
- - Updated dependencies [5c52bee0]
275
- - Updated dependencies [745485cd]
276
- - @latticexyz/store@2.0.0-next.17
277
- - @latticexyz/recs@2.0.0-next.17
278
-
279
- ## 2.0.0-next.16
280
-
281
- ### Patch Changes
282
-
283
- - Updated dependencies [c6c13f2e]
284
- - Updated dependencies [e6c03a87]
285
- - Updated dependencies [37c228c6]
286
- - Updated dependencies [1bf2e908]
287
- - Updated dependencies [37c228c6]
288
- - Updated dependencies [37c228c6]
289
- - Updated dependencies [7b28d32e]
290
- - Updated dependencies [9f8b84e7]
291
- - Updated dependencies [ad4ac445]
292
- - Updated dependencies [37c228c6]
293
- - Updated dependencies [37c228c6]
294
- - Updated dependencies [37c228c6]
295
- - Updated dependencies [3ac68ade]
296
- - Updated dependencies [37c228c6]
297
- - Updated dependencies [103f635e]
298
- - @latticexyz/store@2.0.0-next.16
299
- - @latticexyz/recs@2.0.0-next.16
300
-
301
- ## 2.0.0-next.15
302
-
303
- ### Patch Changes
304
-
305
- - 59054203: TS packages now generate their respective `.d.ts` type definition files for better compatibility when using MUD with `moduleResolution` set to `bundler` or `node16` and fixes issues around missing type declarations for dependent packages.
306
- - 9ef3f9a7: Fixed an issue where `useComponentValue` would not detect a change and re-render if the component value was immediately removed.
307
- - Updated dependencies [d8c8f66b]
308
- - Updated dependencies [1b86eac0]
309
- - Updated dependencies [1077c7f5]
310
- - Updated dependencies [59054203]
311
- - Updated dependencies [6db95ce1]
312
- - Updated dependencies [5d737cf2]
313
- - Updated dependencies [5ac4c97f]
314
- - Updated dependencies [e4817174]
315
- - @latticexyz/store@2.0.0-next.15
316
- - @latticexyz/recs@2.0.0-next.15
317
-
318
- ## 2.0.0-next.14
319
-
320
- ### Patch Changes
321
-
322
- - Updated dependencies [b2d2aa71]
323
- - Updated dependencies [bb91edaa]
324
- - @latticexyz/store@2.0.0-next.14
325
- - @latticexyz/recs@2.0.0-next.14
326
-
327
- ## 2.0.0-next.13
328
-
329
- ### Patch Changes
330
-
331
- - @latticexyz/recs@2.0.0-next.13
332
- - @latticexyz/store@2.0.0-next.13
333
-
334
- ## 2.0.0-next.12
335
-
336
- ### Patch Changes
337
-
338
- - Updated dependencies [7ce82b6f]
339
- - Updated dependencies [f62c767e]
340
- - @latticexyz/store@2.0.0-next.12
341
- - @latticexyz/recs@2.0.0-next.12
342
-
343
- ## 2.0.0-next.11
344
-
345
- ### Patch Changes
346
-
347
- - Updated dependencies [f99e8898]
348
- - @latticexyz/store@2.0.0-next.11
349
- - @latticexyz/recs@2.0.0-next.11
350
-
351
- ## 2.0.0-next.10
352
-
353
- ### Patch Changes
354
-
355
- - Updated dependencies []:
356
- - @latticexyz/recs@2.0.0-next.10
357
- - @latticexyz/store@2.0.0-next.10
358
-
359
- ## 2.0.0-next.9
360
-
361
- ### Patch Changes
362
-
363
- - Updated dependencies [[`aea67c58`](https://github.com/latticexyz/mud/commit/aea67c5804efb2a8b919f5aa3a053d9b04184e84), [`07dd6f32`](https://github.com/latticexyz/mud/commit/07dd6f32c9bb9f0e807bac3586c5cc9833f14ab9), [`90e4161b`](https://github.com/latticexyz/mud/commit/90e4161bb8574a279d9edb517ce7def3624adaa8), [`331dbfdc`](https://github.com/latticexyz/mud/commit/331dbfdcbbda404de4b0fd4d439d636ae2033853), [`f9f9609e`](https://github.com/latticexyz/mud/commit/f9f9609ef69d7fa58cad6a9af3fe6d2eed6d8aa2), [`759514d8`](https://github.com/latticexyz/mud/commit/759514d8b980fa5fe49a4ef919d8008b215f2af8), [`d5094a24`](https://github.com/latticexyz/mud/commit/d5094a2421cf2882a317e3ad9600c8de004b20d4), [`de151fec`](https://github.com/latticexyz/mud/commit/de151fec07b63a6022483c1ad133c556dd44992e), [`ae340b2b`](https://github.com/latticexyz/mud/commit/ae340b2bfd98f4812ed3a94c746af3611645a623), [`211be2a1`](https://github.com/latticexyz/mud/commit/211be2a1eba8600ad53be6f8c70c64a8523113b9), [`0f3e2e02`](https://github.com/latticexyz/mud/commit/0f3e2e02b5114e08fe700c18326db76816ffad3c), [`d0878928`](https://github.com/latticexyz/mud/commit/d08789282c8b8d4c12897e2ff5a688af9115fb1c), [`83583a50`](https://github.com/latticexyz/mud/commit/83583a5053de4e5e643572e3b1c0f49467e8e2ab), [`5e723b90`](https://github.com/latticexyz/mud/commit/5e723b90e6b18bc70d357ff4b0a1b217611236ae), [`6573e38e`](https://github.com/latticexyz/mud/commit/6573e38e9064121540aa46ce204d8ca5d61ed847), [`44a5432a`](https://github.com/latticexyz/mud/commit/44a5432acb9c5af3dca1447c50219a00894c45a9), [`6e66c5b7`](https://github.com/latticexyz/mud/commit/6e66c5b745a036c5bc5422819de9c518a6f6cc96), [`65c9546c`](https://github.com/latticexyz/mud/commit/65c9546c4ee8a410b21d032f02b0050442152e7e), [`672d05ca`](https://github.com/latticexyz/mud/commit/672d05ca130649bd90df337c2bf03204a5878840), [`63831a26`](https://github.com/latticexyz/mud/commit/63831a264b6b09501f380a4601f82ba7bf07a619), [`92de5998`](https://github.com/latticexyz/mud/commit/92de59982fb9fc4e00e50c4a5232ed541f3ce71a), [`22ee4470`](https://github.com/latticexyz/mud/commit/22ee4470047e4611a3cae62e9d0af4713aa1e612), [`be313068`](https://github.com/latticexyz/mud/commit/be313068b158265c2deada55eebfd6ba753abb87), [`ac508bf1`](https://github.com/latticexyz/mud/commit/ac508bf189b098e66b59a725f58a2008537be130), [`bfcb293d`](https://github.com/latticexyz/mud/commit/bfcb293d1931edde7f8a3e077f6f555a26fd1d2f), [`1890f1a0`](https://github.com/latticexyz/mud/commit/1890f1a0603982477bfde1b7335969f51e2dce70), [`9b43029c`](https://github.com/latticexyz/mud/commit/9b43029c3c888f8e82b146312f5c2e92321c28a7), [`55ab88a6`](https://github.com/latticexyz/mud/commit/55ab88a60adb3ad72ebafef4d50513eb71e3c314), [`af639a26`](https://github.com/latticexyz/mud/commit/af639a26446ca4b689029855767f8a723557f62c), [`5e723b90`](https://github.com/latticexyz/mud/commit/5e723b90e6b18bc70d357ff4b0a1b217611236ae), [`99ab9cd6`](https://github.com/latticexyz/mud/commit/99ab9cd6fff1a732b47d63ead894292661682380), [`c049c23f`](https://github.com/latticexyz/mud/commit/c049c23f48b93ac7881fb1a5a8417831611d5cbf), [`80dd6992`](https://github.com/latticexyz/mud/commit/80dd6992e98c90a91d417fc785d0d53260df6ce2), [`24a6cd53`](https://github.com/latticexyz/mud/commit/24a6cd536f0c31cab93fb7644751cb9376be383d), [`708b49c5`](https://github.com/latticexyz/mud/commit/708b49c50e05f7b67b596e72ebfcbd76e1ff6280), [`22ba7b67`](https://github.com/latticexyz/mud/commit/22ba7b675bd50d1bb18b8a71c0de17c6d70d78c7), [`cea754dd`](https://github.com/latticexyz/mud/commit/cea754dde0d8abf7392e93faa319b260956ae92b)]:
364
- - @latticexyz/store@2.0.0-next.9
365
- - @latticexyz/recs@2.0.0-next.9
366
-
367
- ## 2.0.0-next.8
368
-
369
- ### Patch Changes
370
-
371
- - Updated dependencies [[`1d60930d`](https://github.com/latticexyz/mud/commit/1d60930d6d4c9a0bda262e5e23a5f719b9dd48c7), [`b9e562d8`](https://github.com/latticexyz/mud/commit/b9e562d8f7a6051bb1a7262979b268fd2c83daac), [`5e71e1cb`](https://github.com/latticexyz/mud/commit/5e71e1cb541b0a18ee414e18dd80f1dd24a92b98)]:
372
- - @latticexyz/store@2.0.0-next.8
373
- - @latticexyz/recs@2.0.0-next.8
374
-
375
- ## 2.0.0-next.7
376
-
377
- ### Patch Changes
378
-
379
- - Updated dependencies [[`c4d5eb4e`](https://github.com/latticexyz/mud/commit/c4d5eb4e4e4737112b981a795a9c347e3578cb15)]:
380
- - @latticexyz/store@2.0.0-next.7
381
- - @latticexyz/recs@2.0.0-next.7
382
-
383
- ## 2.0.0-next.6
384
-
385
- ### Patch Changes
386
-
387
- - Updated dependencies [[`8025c350`](https://github.com/latticexyz/mud/commit/8025c3505a7411d8539b1cfd72265aed27e04561)]:
388
- - @latticexyz/store@2.0.0-next.6
389
- - @latticexyz/recs@2.0.0-next.6
390
-
391
- ## 2.0.0-next.5
392
-
393
- ### Patch Changes
394
-
395
- - Updated dependencies []:
396
- - @latticexyz/recs@2.0.0-next.5
397
- - @latticexyz/store@2.0.0-next.5
398
-
399
- ## 2.0.0-next.4
400
-
401
- ### Major Changes
402
-
403
- - [#1343](https://github.com/latticexyz/mud/pull/1343) [`e3de1a33`](https://github.com/latticexyz/mud/commit/e3de1a338fe110ac33ba9fb833366541e4cf4cf1) Thanks [@holic](https://github.com/holic)! - Removes `useRow` and `useRows` hooks, previously powered by `store-cache`, which is now deprecated. Please use `recs` and the corresponding `useEntityQuery` and `useComponentValue` hooks. We'll have more hooks soon for SQL.js sync backends.
404
-
405
- ### Patch Changes
406
-
407
- - Updated dependencies [[`ce7125a1`](https://github.com/latticexyz/mud/commit/ce7125a1b97efd3db47c5ea1593d5a37ba143f64), [`c14f8bf1`](https://github.com/latticexyz/mud/commit/c14f8bf1ec8c199902c12899853ac144aa69bb9c)]:
408
- - @latticexyz/recs@2.0.0-next.4
409
- - @latticexyz/store@2.0.0-next.4
410
-
411
- ## 2.0.0-next.3
412
-
413
- ### Patch Changes
414
-
415
- - Updated dependencies [[`952cd534`](https://github.com/latticexyz/mud/commit/952cd534447d08e6231ab147ed1cc24fb49bbb57), [`d5b73b12`](https://github.com/latticexyz/mud/commit/d5b73b12666699c442d182ee904fa8747b78fefd), [`433078c5`](https://github.com/latticexyz/mud/commit/433078c54c22fa1b4e32d7204fb41bd5f79ca1db), [`afaf2f5f`](https://github.com/latticexyz/mud/commit/afaf2f5ffb36fe389a3aba8da2f6d8c84bdb26ab), [`0d12db8c`](https://github.com/latticexyz/mud/commit/0d12db8c2170905f5116111e6bc417b6dca8eb61)]:
416
- - @latticexyz/store@2.0.0-next.3
417
- - @latticexyz/store-cache@2.0.0-next.3
418
- - @latticexyz/recs@2.0.0-next.3
419
-
420
- ## 2.0.0-next.2
421
-
422
- ### Minor Changes
423
-
424
- - [#1284](https://github.com/latticexyz/mud/pull/1284) [`939916bc`](https://github.com/latticexyz/mud/commit/939916bcd5c9f3caf0399e9ab7689e77e6bef7ad) Thanks [@holic](https://github.com/holic)! - Adds a `usePromise` hook that returns a [native `PromiseSettledResult` object](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/allSettled).
425
-
426
- ```tsx
427
- const promise = fetch(url);
428
- const result = usePromise(promise);
429
-
430
- if (result.status === "idle" || result.status === "pending") {
431
- return <>fetching</>;
432
- }
433
-
434
- if (result.status === "rejected") {
435
- return <>error fetching: {String(result.reason)}</>;
436
- }
437
-
438
- if (result.status === "fulfilled") {
439
- return <>fetch status: {result.value.status}</>;
440
- }
441
- ```
442
-
443
- ### Patch Changes
444
-
445
- - Updated dependencies [[`a2588116`](https://github.com/latticexyz/mud/commit/a25881160cb3283e11d218be7b8a9fe38ee83062), [`48c51b52`](https://github.com/latticexyz/mud/commit/48c51b52acab147a2ed97903c43bafa9b6769473)]:
446
- - @latticexyz/store@2.0.0-next.2
447
- - @latticexyz/store-cache@2.0.0-next.2
448
- - @latticexyz/recs@2.0.0-next.2
449
-
450
- ## 2.0.0-next.1
451
-
452
- ### Patch Changes
453
-
454
- - Updated dependencies [[`c963b46c`](https://github.com/latticexyz/mud/commit/c963b46c7eaceebc652930936643365b8c48a021), [`5c965a91`](https://github.com/latticexyz/mud/commit/5c965a919355bf98d7ea69463890fe605bcde206), [`60cfd089`](https://github.com/latticexyz/mud/commit/60cfd089fc7a17b98864b631d265f36718df35a9), [`afdba793`](https://github.com/latticexyz/mud/commit/afdba793fd84abf17eef5ef59dd56fabe353c8bd), [`cc2c8da0`](https://github.com/latticexyz/mud/commit/cc2c8da000c32c02a82a1a0fd17075d11eac56c3)]:
455
- - @latticexyz/store@2.0.0-next.1
456
- - @latticexyz/recs@2.0.0-next.1
457
- - @latticexyz/store-cache@2.0.0-next.1
458
-
459
- ## 2.0.0-next.0
460
-
461
- ### Patch Changes
462
-
463
- - Updated dependencies [[`904fd7d4`](https://github.com/latticexyz/mud/commit/904fd7d4ee06a86e481e3e02fd5744224376d0c9), [`8d51a034`](https://github.com/latticexyz/mud/commit/8d51a03486bc20006d8cc982f798dfdfe16f169f), [`1e2ad78e`](https://github.com/latticexyz/mud/commit/1e2ad78e277b551dd1b8efb0e4438fb10441644c), [`48909d15`](https://github.com/latticexyz/mud/commit/48909d151b3dfceab128c120bc6bb77de53c456b), [`66cc35a8`](https://github.com/latticexyz/mud/commit/66cc35a8ccb21c50a1882d6c741dd045acd8bc11), [`a7b30c79`](https://github.com/latticexyz/mud/commit/a7b30c79bcc78530d2d01858de46a0fb87954fda), [`53522998`](https://github.com/latticexyz/mud/commit/535229984565539e6168042150b45fe0f9b48b0f)]:
464
- - @latticexyz/store@2.0.0-next.0
465
- - @latticexyz/recs@2.0.0-next.0
466
- - @latticexyz/store-cache@2.0.0-next.0
467
-
468
- All notable changes to this project will be documented in this file.
469
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
470
-
471
- # [1.42.0](https://github.com/latticexyz/mud/compare/v1.41.0...v1.42.0) (2023-04-13)
472
-
473
- ### Features
474
-
475
- - v2 event decoding ([#415](https://github.com/latticexyz/mud/issues/415)) ([374ed54](https://github.com/latticexyz/mud/commit/374ed542c3387a4ec2b36ab68ae534419aa58763))
476
-
477
- # [1.41.0](https://github.com/latticexyz/mud/compare/v1.40.0...v1.41.0) (2023-03-09)
478
-
479
- ### Features
480
-
481
- - **react:** option for useEntityQuery to re-render on value changes ([#460](https://github.com/latticexyz/mud/issues/460)) ([6b90b85](https://github.com/latticexyz/mud/commit/6b90b85febe00ff0a2c9a3c4642d0197b5107e35))
482
-
483
- # [1.40.0](https://github.com/latticexyz/mud/compare/v1.39.0...v1.40.0) (2023-03-03)
484
-
485
- **Note:** Version bump only for package @latticexyz/react
486
-
487
- # [1.39.0](https://github.com/latticexyz/mud/compare/v1.38.0...v1.39.0) (2023-02-22)
488
-
489
- **Note:** Version bump only for package @latticexyz/react
490
-
491
- # [1.38.0](https://github.com/latticexyz/mud/compare/v1.37.1...v1.38.0) (2023-02-22)
492
-
493
- **Note:** Version bump only for package @latticexyz/react
494
-
495
- ## [1.37.1](https://github.com/latticexyz/mud/compare/v1.37.0...v1.37.1) (2023-02-17)
496
-
497
- **Note:** Version bump only for package @latticexyz/react
498
-
499
- # [1.37.0](https://github.com/latticexyz/mud/compare/v1.36.1...v1.37.0) (2023-02-16)
500
-
501
- ### Bug Fixes
502
-
503
- - package entry points, peer dep versions ([#409](https://github.com/latticexyz/mud/issues/409)) ([66a7fd6](https://github.com/latticexyz/mud/commit/66a7fd6f74620ce02c60e3d55701d4740cc65251))
504
-
505
- ### Reverts
506
-
507
- - Revert "chore(release): publish v1.37.0" ([c934f53](https://github.com/latticexyz/mud/commit/c934f5388c1e56f2fe6390fdda30f5b9b1ea1c20))
508
-
509
- ## [1.36.1](https://github.com/latticexyz/mud/compare/v1.36.0...v1.36.1) (2023-02-16)
510
-
511
- **Note:** Version bump only for package @latticexyz/react
512
-
513
- # [1.35.0](https://github.com/latticexyz/mud/compare/v1.34.0...v1.35.0) (2023-02-15)
514
-
515
- **Note:** Version bump only for package @latticexyz/react
516
-
517
- # [1.34.0](https://github.com/latticexyz/mud/compare/v1.33.1...v1.34.0) (2023-01-29)
518
-
519
- **Note:** Version bump only for package @latticexyz/react
520
-
521
- ## [1.33.1](https://github.com/latticexyz/mud/compare/v1.33.0...v1.33.1) (2023-01-12)
522
-
523
- **Note:** Version bump only for package @latticexyz/react
524
-
525
- # [1.33.0](https://github.com/latticexyz/mud/compare/v1.32.0...v1.33.0) (2023-01-12)
526
-
527
- ### Features
528
-
529
- - **react:** add react package ([#294](https://github.com/latticexyz/mud/issues/294)) ([f5ee290](https://github.com/latticexyz/mud/commit/f5ee290e776276b2b0dd273705694df04a85f400))
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from "./useComponentValue";
2
- export * from "./useEntityQuery";
3
- export * from "./useObservableValue";
4
- export * from "./usePromise";
@@ -1,111 +0,0 @@
1
- import { renderHook, act } from "@testing-library/react-hooks";
2
- import {
3
- World,
4
- Type,
5
- createWorld,
6
- defineComponent,
7
- Component,
8
- createEntity,
9
- withValue,
10
- setComponent,
11
- removeComponent,
12
- } from "@latticexyz/recs";
13
- import { useComponentValue } from "./useComponentValue";
14
- import { describe, it, expect, beforeEach } from "vitest";
15
-
16
- describe("useComponentValue", () => {
17
- let world: World;
18
- let Position: Component<{
19
- x: Type.Number;
20
- y: Type.Number;
21
- }>;
22
-
23
- beforeEach(() => {
24
- world = createWorld();
25
- Position = defineComponent(world, { x: Type.Number, y: Type.Number }, { id: "Position" });
26
- });
27
-
28
- it("should return Position value for entity", () => {
29
- const entity = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
30
-
31
- const { result } = renderHook(() => useComponentValue(Position, entity));
32
- expect(result.current).toEqual({ x: 1, y: 1 });
33
-
34
- act(() => {
35
- setComponent(Position, entity, { x: 0, y: 0 });
36
- });
37
- expect(result.current).toEqual({ x: 0, y: 0 });
38
-
39
- act(() => {
40
- removeComponent(Position, entity);
41
- });
42
- expect(result.current).toBe(undefined);
43
-
44
- act(() => {
45
- setComponent(Position, entity, { x: 0, y: 0 });
46
- });
47
- expect(result.current).toEqual({ x: 0, y: 0 });
48
- });
49
-
50
- it("should re-render only when Position changes for entity", () => {
51
- const entity = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
52
- const otherEntity = createEntity(world, [withValue(Position, { x: 2, y: 2 })]);
53
-
54
- const { result } = renderHook(() => useComponentValue(Position, entity));
55
- expect(result.all.length).toBe(2);
56
- expect(result.current).toEqual({ x: 1, y: 1 });
57
-
58
- act(() => {
59
- setComponent(Position, entity, { x: 0, y: 0 });
60
- });
61
- expect(result.all.length).toBe(3);
62
- expect(result.current).toEqual({ x: 0, y: 0 });
63
-
64
- act(() => {
65
- setComponent(Position, otherEntity, { x: 0, y: 0 });
66
- removeComponent(Position, otherEntity);
67
- });
68
- expect(result.all.length).toBe(3);
69
- expect(result.current).toEqual({ x: 0, y: 0 });
70
-
71
- act(() => {
72
- removeComponent(Position, entity);
73
- });
74
- expect(result.all.length).toBe(4);
75
- expect(result.current).toBe(undefined);
76
- });
77
-
78
- it("should re-render when Position is removed", () => {
79
- const entity = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
80
-
81
- const { result } = renderHook(() => useComponentValue(Position, entity));
82
- expect(result.current).toEqual({ x: 1, y: 1 });
83
-
84
- act(() => {
85
- removeComponent(Position, entity);
86
- });
87
- expect(result.current).toBe(undefined);
88
-
89
- act(() => {
90
- setComponent(Position, entity, { x: 0, y: 0 });
91
- });
92
- expect(result.current).toEqual({ x: 0, y: 0 });
93
- });
94
-
95
- it("should return default value when Position is not set", () => {
96
- const entity = createEntity(world);
97
-
98
- const { result } = renderHook(() => useComponentValue(Position, entity, { x: -1, y: -1 }));
99
- expect(result.current).toEqual({ x: -1, y: -1 });
100
-
101
- act(() => {
102
- setComponent(Position, entity, { x: 0, y: 0 });
103
- });
104
- expect(result.current).toEqual({ x: 0, y: 0 });
105
-
106
- act(() => {
107
- removeComponent(Position, entity);
108
- });
109
- expect(result.current).toEqual({ x: -1, y: -1 });
110
- });
111
- });
@@ -1,47 +0,0 @@
1
- import {
2
- Component,
3
- ComponentValue,
4
- defineQuery,
5
- Entity,
6
- getComponentValue,
7
- Has,
8
- isComponentUpdate,
9
- Schema,
10
- } from "@latticexyz/recs";
11
- import { useEffect, useState } from "react";
12
-
13
- export function useComponentValue<S extends Schema>(
14
- component: Component<S>,
15
- entity: Entity | undefined,
16
- defaultValue: ComponentValue<S>,
17
- ): ComponentValue<S>;
18
-
19
- export function useComponentValue<S extends Schema>(
20
- component: Component<S>,
21
- entity: Entity | undefined,
22
- ): ComponentValue<S> | undefined;
23
-
24
- export function useComponentValue<S extends Schema>(
25
- component: Component<S>,
26
- entity: Entity | undefined,
27
- defaultValue?: ComponentValue<S>,
28
- ) {
29
- const [value, setValue] = useState(entity != null ? getComponentValue(component, entity) : undefined);
30
-
31
- useEffect(() => {
32
- // component or entity changed, update state to latest value
33
- setValue(entity != null ? getComponentValue(component, entity) : undefined);
34
- if (entity == null) return;
35
-
36
- const queryResult = defineQuery([Has(component)], { runOnInit: true });
37
- const subscription = queryResult.update$.subscribe((update) => {
38
- if (isComponentUpdate(update, component) && update.entity === entity) {
39
- const [nextValue] = update.value;
40
- setValue(nextValue);
41
- }
42
- });
43
- return () => subscription.unsubscribe();
44
- }, [component, entity]);
45
-
46
- return value ?? defaultValue;
47
- }
@@ -1,164 +0,0 @@
1
- import { renderHook, act } from "@testing-library/react-hooks";
2
- import {
3
- World,
4
- Type,
5
- createWorld,
6
- defineComponent,
7
- Component,
8
- createEntity,
9
- withValue,
10
- Has,
11
- setComponent,
12
- HasValue,
13
- removeComponent,
14
- } from "@latticexyz/recs";
15
- import { useEntityQuery } from "./useEntityQuery";
16
- import { describe, beforeEach, it, expect } from "vitest";
17
-
18
- describe("useEntityQuery", () => {
19
- let world: World;
20
- let Position: Component<{
21
- x: Type.Number;
22
- y: Type.Number;
23
- }>;
24
- let OwnedBy: Component<{ value: Type.Entity }>;
25
-
26
- beforeEach(() => {
27
- world = createWorld();
28
- Position = defineComponent(world, { x: Type.Number, y: Type.Number }, { id: "Position" });
29
- OwnedBy = defineComponent(world, { value: Type.Entity }, { id: "OwnedBy" });
30
- });
31
-
32
- it("should find entities with Position component", () => {
33
- const entity1 = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
34
- const entity2 = createEntity(world, [withValue(Position, { x: 2, y: 2 })]);
35
- const entity3 = createEntity(world, []);
36
-
37
- const { result } = renderHook(() => useEntityQuery([Has(Position)], { updateOnValueChange: false }));
38
- const { result: resultOnValueChange } = renderHook(() =>
39
- useEntityQuery([Has(Position)], { updateOnValueChange: true }),
40
- );
41
-
42
- expect(result.current.length).toBe(2);
43
- expect(result.current).toContain(entity1);
44
- expect(result.current).toContain(entity2);
45
- expect(result.current).not.toContain(entity3);
46
- expect(resultOnValueChange.current).toEqual(result.current);
47
-
48
- act(() => {
49
- setComponent(Position, entity3, { x: 0, y: 0 });
50
- });
51
-
52
- expect(result.current.length).toBe(3);
53
- expect(result.current).toContain(entity1);
54
- expect(result.current).toContain(entity2);
55
- expect(result.current).toContain(entity3);
56
- expect(resultOnValueChange.current).toEqual(result.current);
57
-
58
- act(() => {
59
- removeComponent(Position, entity1);
60
- removeComponent(Position, entity3);
61
- });
62
-
63
- expect(result.current.length).toBe(1);
64
- expect(result.current).not.toContain(entity1);
65
- expect(result.current).toContain(entity2);
66
- expect(result.current).not.toContain(entity3);
67
- expect(resultOnValueChange.current).toEqual(result.current);
68
-
69
- act(() => {
70
- removeComponent(Position, entity2);
71
- });
72
-
73
- expect(result.current.length).toBe(0);
74
- });
75
-
76
- it("should re-render only when Position changes", () => {
77
- const entity1 = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
78
- const entity2 = createEntity(world, [withValue(Position, { x: 2, y: 2 })]);
79
- const entity3 = createEntity(world, []);
80
-
81
- const { result } = renderHook(() => useEntityQuery([Has(Position)], { updateOnValueChange: false }));
82
- const { result: resultOnValueChange } = renderHook(() =>
83
- useEntityQuery([Has(Position)], { updateOnValueChange: true }),
84
- );
85
-
86
- expect(result.all).toHaveLength(2);
87
- expect(result.current).toHaveLength(2);
88
- expect(result.current).toContain(entity1);
89
- expect(result.current).toContain(entity2);
90
- expect(result.current).not.toContain(entity3);
91
-
92
- // Changing an entity's component value should NOT re-render,
93
- // unless updateOnValueChange === true
94
- act(() => {
95
- setComponent(Position, entity2, { x: 0, y: 0 });
96
- });
97
-
98
- expect(result.all).toHaveLength(2);
99
- expect(resultOnValueChange.all).toHaveLength(3);
100
-
101
- // Changing a different component value should NOT re-render
102
- act(() => {
103
- setComponent(OwnedBy, entity2, { value: entity1 });
104
- setComponent(OwnedBy, entity3, { value: entity1 });
105
- });
106
-
107
- expect(result.all).toHaveLength(2);
108
- expect(resultOnValueChange.all).toHaveLength(3);
109
-
110
- // Changing which entities have the component should re-render
111
- act(() => {
112
- setComponent(Position, entity3, { x: 0, y: 0 });
113
- });
114
-
115
- expect(result.all).toHaveLength(3);
116
- expect(resultOnValueChange.all).toHaveLength(4);
117
- expect(result.current).toHaveLength(3);
118
- expect(result.current).toContain(entity1);
119
- expect(result.current).toContain(entity2);
120
- expect(result.current).toContain(entity3);
121
-
122
- // Changing which entities have the component should re-render
123
- act(() => {
124
- removeComponent(Position, entity1);
125
- });
126
-
127
- expect(result.all).toHaveLength(4);
128
- expect(resultOnValueChange.all).toHaveLength(5);
129
- expect(result.current).toHaveLength(2);
130
- expect(result.current).toContain(entity2);
131
- expect(result.current).toContain(entity3);
132
- });
133
-
134
- it("should re-render as hook arguments change", () => {
135
- // TODO: reduce re-renders during argument changes?
136
-
137
- const entity1 = createEntity(world, [withValue(Position, { x: 1, y: 1 })]);
138
- const entity2 = createEntity(world, [withValue(Position, { x: 2, y: 2 })]);
139
- const entity3 = createEntity(world, [withValue(Position, { x: 2, y: 2 })]);
140
-
141
- const { result, rerender } = renderHook(({ x, y }) => useEntityQuery([HasValue(Position, { x, y })]), {
142
- initialProps: { x: 1, y: 1 },
143
- });
144
-
145
- expect(result.all).toHaveLength(2);
146
- expect(result.current).toHaveLength(1);
147
- expect(result.current).toContain(entity1);
148
-
149
- rerender({ x: 1, y: 1 });
150
- expect(result.all).toHaveLength(3);
151
- expect(result.current).toHaveLength(1);
152
- expect(result.current).toContain(entity1);
153
-
154
- rerender({ x: 2, y: 2 });
155
- expect(result.all).toHaveLength(6);
156
- expect(result.current).toHaveLength(2);
157
- expect(result.current).toContain(entity2);
158
- expect(result.current).toContain(entity3);
159
-
160
- rerender({ x: -1, y: -1 });
161
- expect(result.all).toHaveLength(9);
162
- expect(result.current).toHaveLength(0);
163
- });
164
- });
@@ -1,37 +0,0 @@
1
- import { defineQuery, QueryFragment } from "@latticexyz/recs";
2
- import { useEffect, useMemo, useState } from "react";
3
- import { useDeepMemo } from "./utils/useDeepMemo";
4
- import isEqual from "fast-deep-equal";
5
- import { distinctUntilChanged, map } from "rxjs";
6
-
7
- // This does a little more rendering than is necessary when arguments change,
8
- // but at least it's giving correct results now. Will optimize later!
9
-
10
- /**
11
- * Returns all matching entities for a given entity query,
12
- * and triggers a re-render as new query results come in.
13
- *
14
- * @param fragments Query fragments to match against, executed from left to right.
15
- * @param options.updateOnValueChange False - re-renders only on entity array changes. True (default) - also on component value changes.
16
- * @returns Set of entities matching the query fragments.
17
- */
18
- export function useEntityQuery(fragments: QueryFragment[], options?: { updateOnValueChange?: boolean }) {
19
- const updateOnValueChange = options?.updateOnValueChange ?? true;
20
-
21
- const stableFragments = useDeepMemo(fragments);
22
- const query = useMemo(() => defineQuery(stableFragments, { runOnInit: true }), [stableFragments]);
23
- const [entities, setEntities] = useState([...query.matching]);
24
-
25
- useEffect(() => {
26
- setEntities([...query.matching]);
27
- let observable = query.update$.pipe(map(() => [...query.matching]));
28
- if (!updateOnValueChange) {
29
- // re-render only on entity array changes
30
- observable = observable.pipe(distinctUntilChanged((a, b) => isEqual(a, b)));
31
- }
32
- const subscription = observable.subscribe((entities) => setEntities(entities));
33
- return () => subscription.unsubscribe();
34
- }, [query, updateOnValueChange]);
35
-
36
- return entities;
37
- }
@@ -1,17 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import { Observable } from "rxjs";
3
-
4
- export function useObservableValue<T>(observable: Observable<T>, defaultValue: T): T;
5
-
6
- export function useObservableValue<T>(observable: Observable<T>): T | undefined;
7
-
8
- export function useObservableValue<T>(observable: Observable<T>, defaultValue?: T) {
9
- const [value, setValue] = useState(defaultValue);
10
-
11
- useEffect(() => {
12
- const subscription = observable.subscribe(setValue);
13
- return () => subscription.unsubscribe();
14
- }, [observable]);
15
-
16
- return value;
17
- }
package/src/usePromise.ts DELETED
@@ -1,31 +0,0 @@
1
- import { useEffect, useRef, useState } from "react";
2
-
3
- // TODO: narrow type so `null`/`undefined` always return `{status: "idle"}`?
4
-
5
- export type UsePromiseResult<T> = PromiseSettledResult<Awaited<T>> | { status: "pending" } | { status: "idle" };
6
-
7
- export function usePromise<T>(promise: PromiseLike<T> | null | undefined) {
8
- const promiseRef = useRef(promise);
9
- const [result, setResult] = useState<UsePromiseResult<T>>(
10
- promise == null ? { status: "idle" } : { status: "pending" },
11
- );
12
-
13
- useEffect(() => {
14
- if (promise !== promiseRef.current) {
15
- promiseRef.current = promise;
16
- setResult(promise == null ? { status: "idle" } : { status: "pending" });
17
- }
18
- }, [promise]);
19
-
20
- useEffect(() => {
21
- if (promise == null) return;
22
- // TODO: do we need to check if result is already populated?
23
- Promise.allSettled([promise]).then(([settled]) => {
24
- if (promise === promiseRef.current) {
25
- setResult(settled);
26
- }
27
- });
28
- }, [promise]);
29
-
30
- return result;
31
- }
@@ -1,15 +0,0 @@
1
- import { useEffect, useState } from "react";
2
- import isEqual from "fast-deep-equal";
3
-
4
- export const useDeepMemo = <T>(currentValue: T): T => {
5
- const [stableValue, setStableValue] = useState(currentValue);
6
-
7
- useEffect(() => {
8
- if (!isEqual(currentValue, stableValue)) {
9
- setStableValue(currentValue);
10
- }
11
- // eslint-disable-next-line react-hooks/exhaustive-deps
12
- }, [currentValue]);
13
-
14
- return stableValue;
15
- };
@@ -1,23 +0,0 @@
1
- import { Dispatch, SetStateAction, useCallback, useEffect, useRef, useState } from "react";
2
-
3
- /**
4
- * Use in place of useState when the component may be unmounted before the state is updated.
5
- */
6
- export function useMountedState<T>(initialState: T | (() => T)): [T, Dispatch<SetStateAction<T>>] {
7
- const [state, setState] = useState<T>(initialState);
8
- const mountedRef = useRef(false);
9
- useEffect(() => {
10
- mountedRef.current = true;
11
- return () => {
12
- mountedRef.current = false;
13
- };
14
- });
15
- const mountedSetState: typeof setState = useCallback((...args) => {
16
- if (mountedRef.current) {
17
- setState(...args);
18
- } else {
19
- console.warn("Ignoring `setState` call because component unmounted", ...args);
20
- }
21
- }, []);
22
- return [state, mountedSetState];
23
- }