Explanation of How Messages are Loaded in React App

1 month ago
10

The lecture goes over an explanation of how chat room or board messages are retrieved for a React app.

It goes over the call to the fetch function that returns a Promise.

Then it goes over how the Promise returned by fetch gets fulfilled with a Response object.

The body of the response is extracted and turned into an array of objects in JavaScript.

A new array of strings is made after calling map on the array of message post objects.

Finally, the mutation function from React useState is called to signal React the state for messages has changed, triggering the rendering of the component anew.

Loading 2 comments...