Upgrading
The rejection value for failed requests with
useFetch
was changed. Previously it was the Response object. Now it's an Error object with response
property. If you are using useFetch
and are using the error
value, expecting it to be of type Response, you must now use error.response
instead.All standalone helper components were renamed to avoid import naming collision.
<Initial>
was renamed to<IfInitial>
.<Pending>
was renamed to<IfPending>
.<Fulfilled>
was renamed to<IfFulfilled>
.<Rejected>
was renamed to<IfRejected
.<Settled>
was renamed to<IfSettled>
.
The return type for
run
was changed from Promise
to undefined
. You should now use the promise
prop instead. This is a manual upgrade. See promise
for details.<Async.Pending>
was renamed to<Async.Initial>
.- Some of the other helpers were also renamed, but the old ones remain as alias.
- Don't forget to deal with any custom instances of
<Async>
when upgrading.
deferFn
now receives anargs
array as the first argument, instead of arguments torun
being spread at the front of the arguments list. This enables better interop with TypeScript. You can use destructuring to keep using your existing variables.- The shorthand version of
useAsync
now takes theoptions
object as optional second argument. This used to beinitialValue
, but was undocumented and inflexible.
Last modified 3yr ago