Skip to content

React Async

  • Resolved an issue with ambiguous imports, where helpers such as Fulfilled clash with React.Fulfilled (#73)
  • Added promise render prop to allow chaining on it (#83)
  • Better TypeScript definitions for helper components (#72)
  • Applied useCallback to the returned functions such as run, cancel and reload (hooks only) (#82)
  • Allow modification of useFetch's init param from run (#76 by @phryneas)
  • Improved TypeScript types for promiseFn/deferFn props
  • Introduced codemods for automatic upgrades
  • Aligned version numbers for all packages and examples

Breaking change: renamed helpers

All stand-alone helper components are renamed without backwards compatibility. Child components of <Async> are unaffected. To upgrade:

  • replace <Initial> with <IfInitial>
  • replace <Pending> with <IfPending>
  • replace <Fulfilled> with <IfFulfilled>
  • replace <Rejected> with <IfRejected>
  • replace <Settled> with <IfSettled>

Note this does not apply to <Async.Initial> and the like.

A codemod is available to automate the upgrade.

Breaking change: run return type

The return type for run was changed from Promise to undefined. You should now use the promise prop instead. This is a manual upgrade. For example:

- const { run } = useAsync(...)
+ const { run, promise } = useAsync(...)

+ useEffect(() => {
+   promise.then(onData, onError)
+ }, [promise])

- const handleClick = () => run(arg).then(onData, onError)
+ const handleClick = () => run(arg)
Assets 2

@ghengeveld ghengeveld released this Aug 9, 2019 · 48 commits to master since this release

Pre-release, superseded by v8.0.0.

Assets 2

This fixes a bug in useAsync where calling run() would invoke deferFn with outdated props. See #69.

Assets 2
  • Introduce universal globalScope object needed for DevTools
  • Fix compatibility with React Native (#65).
  • Fix state is undefined issue in Next.js.
  • Fix deprecated url prop in Next.js.
  • Add React Native (Expo) example
Assets 2

@ghengeveld ghengeveld released this Jul 21, 2019 · 74 commits to master since this release

  • Use new globalScope object added in v7.0.5
Assets 2
  • This fixes the type definition for createInstance (#57)

Special thanks to @ndelangen for help on getting the types right.

Assets 2

This adds and LICENSE to the packaged modules before publishing.
Specifically this fixes the project page on

Assets 2

This introduces the onCancel callback and fixes server-side rendering.

Assets 2

@ghengeveld ghengeveld released this Jul 11, 2019 · 90 commits to master since this release

This adds and LICENSE to the bundle before publishing.

Assets 2
You can’t perform that action at this time.