FreeCodeCamp.com Challenge: Build a Tribute Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct Message { | |
nsString mEventName; | |
nsString mLastEventID; | |
nsString mData; | |
}; | |
void EventSourceEventService::EventSourceMessageReceived( | |
uint64_t aInnerWindowID, | |
uint64_t aHttpChannelId, | |
const nsACString& aEventName, |
Three problems with this code:
SuspensefulUserProfile
is not correctly utilizing the Suspense. We need to fetch data as we render, instead of first rendering and then fetching (through useEffect).UserProfile
component should be responsible for fetching the data instead ofSuspensefulUserProfile
.- There is no fallback component. This will lead to a poor user experience.
Corrected:
import { Suspense, useState, useEffect } from 'react';