Use with Async/Await
Instead of chaining your async code with .then().then().then()
, you can use async/await.
Consider this example. First, request fooData
, then request barData
and exit the function (also resolving the promise).
Async/await can be combined with data for optimistic updates:
Please note there is no need to return await
in an async function. See this ESLint rule for more details.
Last updated