Loading
Lesson 68
Courses / Software School Cuts
Explanation of How Messages are Loaded in React App

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.

No comments yet (loading...)
No comments yet (loading...)
Did you like the lesson? 😆👍
Consider a donation to support our work: