@@ -22,11 +22,11 @@ export { useAsyncIterState, type AsyncIterStateResult, type AsyncIterableChannel
22
22
* ```tsx
23
23
* // Quick usage:
24
24
*
25
- * import { useAsyncIterState, Iterate } from 'async- react-iterators';
25
+ * import { useAsyncIterState, Iterate } from 'react-async -iterators';
26
26
*
27
27
* function MyForm() {
28
- * const [firstNameIter, setFirstName] = useAsyncIterState<string>( );
29
- * const [lastNameIter, setLastName] = useAsyncIterState<string>( );
28
+ * const [firstNameIter, setFirstName] = useAsyncIterState('' );
29
+ * const [lastNameIter, setLastName] = useAsyncIterState('' );
30
30
* return (
31
31
* <div>
32
32
* <form>
@@ -43,9 +43,10 @@ export { useAsyncIterState, type AsyncIterStateResult, type AsyncIterableChannel
43
43
* ---
44
44
*
45
45
* The returned async iterable can be passed over to any level down the component tree and rendered
46
- * using `<Iterate>`, `useAsyncIter`, and so on. It also contains a `.current.value` property which shows
47
- * the current up to date state value at all times. Use this any case you just need to read the immediate
48
- * current state rather than directly rendering it, since for rendering you may simply async-iterate it.
46
+ * using `<Iterate>`, `useAsyncIter`, and others. It also contains a `.current.value` property which shows
47
+ * the current up to date state value at all times. Use this any time you need to read the immediate
48
+ * current state (for example as part of side effect logic) rather than directly rendering it, since
49
+ * for rendering you may simply iterate values as part of an `<Iterate>`.
49
50
*
50
51
* Returned also alongside the async iterable is a function for updating the state. Calling it with a new
51
52
* value will cause the paired iterable to yield the updated state value as well as immediately set the
@@ -55,19 +56,19 @@ export { useAsyncIterState, type AsyncIterStateResult, type AsyncIterableChannel
55
56
*
56
57
* Unlike vanila `React.useState`, which simply re-renders the entire component - `useAsyncIterState`
57
58
* helps confine UI updates by handing you an iterable which choose how and where in the component tree
58
- * to render it. This work method can facilitate layers of sub-components that pass actual async iterables
59
- * across one another as props, skipping typical cascading re-renderings down to __only the inner-most
60
- * leafs__ of the UI tree.
59
+ * to render it. This method of working can facilitate layers of sub-components that pass actual async
60
+ * iterables down to one another as props, avoiding typical cascading re-renderings, updating __only
61
+ * the inner-most leafs__ in the UI tree instead .
61
62
*
62
63
* @example
63
64
* ```tsx
64
65
* // Use the state iterable's `.current.value` property to read the immediate current state:
65
66
*
66
- * import { useAsyncIterState } from 'async- react-iterators';
67
+ * import { useAsyncIterState } from 'react-async -iterators';
67
68
*
68
69
* function MyForm() {
69
- * const [firstNameIter, setFirstName] = useAsyncIterState<string>( );
70
- * const [lastNameIter, setLastName] = useAsyncIterState<string>( );
70
+ * const [firstNameIter, setFirstName] = useAsyncIterState('' );
71
+ * const [lastNameIter, setLastName] = useAsyncIterState('' );
71
72
*
72
73
* return (
73
74
* <form
0 commit comments