React Asynchronous Data

Learn to simulate asynchronous data in the application.

We'll cover the following

We have two interactions in our application: searching the list, and removing items from the list. The first interaction is a fluctuant interference through a third-party state (searchTerm) applied on the list; the second interaction is a non-reversible deletion of an item from the list.

Sometimes we must render a component before we can fetch data from a third-party API and display it. In the following, we will simulate this kind of asynchronous data in the application. In a live application, this asynchronous data gets fetched from a real remote API. We start off with a function that returns a promise – data, once it resolves – in its shorthand version. The resolved object holds the previous list of stories:

Get hands-on with 1400+ tech skills courses.