Async Functions

In this lesson, we briefly go over the async functions.

We'll cover the following

Async functions

Async functions are typically used to fetch data from a server. There are different types of async functions, like timers, but the basics are the same: They don’t return the result synchronously. Async functions run outside React render functions and require a special way of coding.

useEffect

Often, useEffect is used to start async functions. That’s one valid way, but it tends to work unexpectedly and it will not be mainstream once Suspense for data fetching lands.

use-reducer-async

There are several libraries to start async functions in dispatch or event callback. One of these is use-reducer-async, which works well for small async functions. It can be used with React Tracked.

Next

In the next lesson, we get a brief overview of how the Redux ecosystem can help us.

Create a free account to view this lesson.

Continue your learning journey with a 14-day free trial.

By signing up, you agree to Educative's Terms of Service and Privacy Policy