From 9ef7c4dbd83826007865f78123cdb1278c212104 Mon Sep 17 00:00:00 2001 From: Gert Hengeveld Date: Fri, 29 Mar 2019 11:51:03 +0100 Subject: [PATCH] Add upgrading information. --- README.md | 26 ++++++++++++++++++-------- 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 13a2a2b8..a76d32ad 100644 --- a/README.md +++ b/README.md @@ -50,21 +50,16 @@ error states, without assumptions about the shape of your data or the type of re [abortable fetch]: https://developers.google.com/web/updates/2017/09/abortable-fetch -> ## Upgrading to v4 +> ## Upgrading to v6 > -> When upgrading to React Async v4, please note the following breaking API changes: -> -> - `deferFn` now receives an `args` array as the first argument, instead of arguments to `run` 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 the `options` object as optional second argument. This used to be -> `initialValue`, but was undocumented and inflexible. +> Version 6 comes with a breaking change. See [Upgrading](#upgrading) for details. # Table of Contents - [Rationale](#rationale) - [Concurrent React and Suspense](#concurrent-react-and-suspense) - [Installation](#installation) + - [Upgrading](#upgrading) - [Usage](#usage) - [As a hook](#as-a-hook) - [With `useFetch`](#with-usefetch) @@ -124,6 +119,21 @@ yarn add react-async > This package requires `react` as a peer dependency. Please make sure to install that as well. > If you want to use the `useAsync` hook, you'll need `react@16.8.0` or later. +### Upgrading + +#### Upgrade to v6 + +- `` was renamed to ``. +- Don't forget to deal with any custom instances of `` when upgrading. + +#### Upgrade to v4 + +- `deferFn` now receives an `args` array as the first argument, instead of arguments to `run` 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 the `options` object as optional second argument. This used to be + `initialValue`, but was undocumented and inflexible. + ## Usage React Async offers three primary APIs: the `useAsync` hook, the `` component and the `createInstance`