@@ -38,7 +38,7 @@ error states, without assumptions about the shape of your data or the type of re
3838- Zero dependencies
3939- Works with promises, async/await and the Fetch API
4040- Choose between Render Props, Context-based helper components or the ` useAsync ` and ` useFetch ` hooks
41- - Provides convenient ` isLoading ` , ` startedAt ` and ` finishedAt ` metadata
41+ - Provides convenient ` isLoading ` , ` startedAt ` , ` finishedAt ` , et al metadata
4242- Provides ` cancel ` and ` reload ` actions
4343- Automatic re-run using ` watch ` or ` watchFn ` prop
4444- Accepts ` onResolve ` and ` onReject ` callbacks
@@ -201,7 +201,7 @@ is set to `"application/json"`.
201201
202202### As a component
203203
204- The classic interface to React Async. Simply use <Async > directly in your JSX component tree, leveraging the render
204+ The classic interface to React Async. Simply use ` <Async> ` directly in your JSX component tree, leveraging the render
205205props pattern:
206206
207207``` js
@@ -248,14 +248,14 @@ const loadCustomer = ({ customerId }, { signal }) =>
248248const MyComponent = () => (
249249 < Async promiseFn= {loadCustomer} customerId= {1 }>
250250 < Async .Loading > Loading... < / Async .Loading >
251- < Async .Resolved >
251+ < Async .Fulfilled >
252252 {data => (
253253 < div>
254254 < strong> Loaded some data: < / strong>
255255 < pre> {JSON .stringify (data, null , 2 )}< / pre>
256256 < / div>
257257 )}
258- < / Async .Resolved >
258+ < / Async .Fulfilled >
259259 < Async .Rejected > {error => ` Something went wrong: ${ error .message } ` }< / Async .Rejected >
260260 < / Async>
261261)
@@ -279,7 +279,7 @@ const AsyncCustomer = createInstance({ promiseFn: loadCustomer }, "AsyncCustomer
279279
280280const MyComponent = () => (
281281 < AsyncCustomer customerId= {1 }>
282- < AsyncCustomer .Resolved > {customer => ` Hello ${ customer .name } ` }< / AsyncCustomer .Resolved >
282+ < AsyncCustomer .Fulfilled > {customer => ` Hello ${ customer .name } ` }< / AsyncCustomer .Fulfilled >
283283 < / AsyncCustomer>
284284)
285285```
@@ -316,7 +316,7 @@ and listen to the new one. If `promise` is initially undefined, the React Async
316316
317317#### ` promiseFn `
318318
319- > ` function(props: object , controller: AbortController): Promise `
319+ > ` function(props: Object , controller: AbortController): Promise `
320320
321321A function that returns a promise. It is automatically invoked in ` componentDidMount ` and ` componentDidUpdate ` .
322322The function receives all component props (or options) and an AbortController instance as arguments.
@@ -329,14 +329,14 @@ The function receives all component props (or options) and an AbortController in
329329
330330#### ` deferFn `
331331
332- > ` function(args: any[], props: object , controller: AbortController): Promise `
332+ > ` function(args: any[], props: Object , controller: AbortController): Promise `
333333
334334A function that returns a promise. This is invoked only by manually calling ` run(...args) ` . Receives the same arguments
335335as ` promiseFn ` , as well as any arguments to ` run ` which are passed through as an array. The ` deferFn ` is commonly used
336336to send data to the server following a user action, such as submitting a form. You can use this in conjunction with
337337` promiseFn ` to fill the form with existing data, then updating it on submit with ` deferFn ` .
338338
339- > Be aware that when using both ` promiseFn ` and ` deferFn ` , the shape of their resolved value should match, because they
339+ > Be aware that when using both ` promiseFn ` and ` deferFn ` , the shape of their fulfilled value should match, because they
340340> both update the same ` data ` .
341341
342342#### ` watch `
@@ -348,7 +348,7 @@ reference check (`oldValue !== newValue`). If you need a more complex update che
348348
349349#### ` watchFn `
350350
351- > ` function(props: object , prevProps: object ): boolean | any `
351+ > ` function(props: Object , prevProps: Object ): boolean | any `
352352
353353Re-runs the ` promiseFn ` when this callback returns truthy (called on every update). Any default props specified by
354354` createInstance ` are available too.
@@ -393,7 +393,7 @@ is set to `"application/json"`.
393393- ` error ` Rejected promise reason, cleared when new data arrives.
394394- ` initialValue ` The data or error that was provided through the ` initialValue ` prop.
395395- ` startedAt ` When the current/last promise was started.
396- - ` finishedAt ` When the last promise was resolved or rejected.
396+ - ` finishedAt ` When the last promise was fulfilled or rejected.
397397- ` status ` One of: ` initial ` , ` pending ` , ` fulfilled ` , ` rejected ` .
398398- ` isInitial ` true when no promise has ever started, or one started but was cancelled.
399399- ` isPending ` true when a promise is currently awaiting settlement. Alias: ` isLoading `
@@ -403,7 +403,7 @@ is set to `"application/json"`.
403403- ` counter ` The number of times a promise was started.
404404- ` cancel ` Cancel any pending promise.
405405- ` run ` Invokes the ` deferFn ` .
406- - ` reload ` Re-runs the promise when invoked, using the any previous arguments.
406+ - ` reload ` Re-runs the promise when invoked, using any previous arguments.
407407- ` setData ` Sets ` data ` to the passed value, unsets ` error ` and cancels any pending promise.
408408- ` setError ` Sets ` error ` to the passed value and cancels any pending promise.
409409
@@ -454,15 +454,15 @@ These are available for import as `statusTypes`.
454454
455455> ` boolean `
456456
457- ` true ` while a promise is pending (loading), ` false ` otherwise.
457+ ` true ` while a promise is pending (aka loading), ` false ` otherwise.
458458
459459Alias: ` isLoading `
460460
461461#### ` isFulfilled `
462462
463463> ` boolean `
464464
465- ` true ` when the last promise was fulfilled (resolved) with a value.
465+ ` true ` when the last promise was fulfilled (aka resolved) with a value.
466466
467467Alias: ` isResolved `
468468
@@ -528,7 +528,7 @@ Renders only while the deferred promise is still waiting to be run, or you have
528528#### Props
529529
530530- ` persist ` ` boolean ` Show until we have data, even while loading or when an error occurred. By default it hides as soon as the promise starts loading.
531- - ` children ` ` function(state: object ): Node | Node ` Render function or React Node.
531+ - ` children ` ` function(state: Object ): Node | Node ` Render function or React Node.
532532
533533#### Examples
534534
@@ -542,10 +542,10 @@ Renders only while the deferred promise is still waiting to be run, or you have
542542
543543``` js
544544< Async .Initial persist>
545- {({ error, isLoading , run }) => (
545+ {({ error, isPending , run }) => (
546546 < div>
547- < p> This text is only rendered while the promise has not resolved yet.< / p>
548- < button onClick= {run} disabled= {! isLoading }>
547+ < p> This text is only rendered while the promise has not fulfilled yet.< / p>
548+ < button onClick= {run} disabled= {! isPending }>
549549 Run
550550 < / button>
551551 {error && < p> {error .message }< / p> }
@@ -556,14 +556,14 @@ Renders only while the deferred promise is still waiting to be run, or you have
556556
557557### ` <Async.Pending> `
558558
559- This component renders only while the promise is loading (unsettled).
559+ This component renders only while the promise is pending (aka loading) (unsettled).
560560
561561Alias: ` <Async.Loading> `
562562
563563#### Props
564564
565565- ` initial ` ` boolean ` Show only on initial load (when ` data ` is ` undefined ` ).
566- - ` children ` ` function(state: object ): Node | Node ` Render function or React Node.
566+ - ` children ` ` function(state: Object ): Node | Node ` Render function or React Node.
567567
568568#### Examples
569569
@@ -586,7 +586,7 @@ Alias: `<Async.Resolved>`
586586#### Props
587587
588588- ` persist ` ` boolean ` Show old data while loading new data. By default it hides as soon as a new promise starts.
589- - ` children ` ` function(data: any, state: object ): Node | Node ` Render function or React Node.
589+ - ` children ` ` function(data: any, state: Object ): Node | Node ` Render function or React Node.
590590
591591#### Examples
592592
@@ -595,7 +595,7 @@ Alias: `<Async.Resolved>`
595595```
596596
597597``` js
598- < Async .Fulfilled > {({ finishedAt }) => ` Last updated ${ startedAt .toISOString ()} ` }< / Async .Fulfilled >
598+ < Async .Fulfilled > {(data , { finishedAt }) => ` Last updated ${ finishedAt .toISOString ()} ` }< / Async .Fulfilled >
599599```
600600
601601### ` <Async.Rejected> `
@@ -605,7 +605,7 @@ This component renders only when the promise is rejected.
605605#### Props
606606
607607- ` persist ` ` boolean ` Show old error while loading new data. By default it hides as soon as a new promise starts.
608- - ` children ` ` function(error: Error, state: object ): Node | Node ` Render function or React Node.
608+ - ` children ` ` function(error: Error, state: Object ): Node | Node ` Render function or React Node.
609609
610610#### Examples
611611
@@ -624,7 +624,7 @@ This component renders only when the promise is fulfilled or rejected.
624624#### Props
625625
626626- ` persist ` ` boolean ` Show old data or error while loading new data. By default it hides as soon as a new promise starts.
627- - ` children ` ` function(state: object ): Node | Node ` Render function or React Node.
627+ - ` children ` ` function(state: Object ): Node | Node ` Render function or React Node.
628628
629629## Usage examples
630630
0 commit comments