Skip to content

Instantly share code, notes, and snippets.

Three problems with this code:

  1. SuspensefulUserProfile is not correctly utilizing the Suspense. We need to fetch data as we render, instead of first rendering and then fetching (through useEffect).
  2. UserProfile component should be responsible for fetching the data instead of SuspensefulUserProfile.
  3. There is no fallback component. This will lead to a poor user experience.

Corrected:

import { Suspense, useState, useEffect } from 'react';
@FarooqAR
FarooqAR / EventSourceService.cpp
Last active March 13, 2020 10:48
Potential required work for Server-sent events (gsoc)
struct Message {
nsString mEventName;
nsString mLastEventID;
nsString mData;
};
void EventSourceEventService::EventSourceMessageReceived(
uint64_t aInnerWindowID,
uint64_t aHttpChannelId,
const nsACString& aEventName,
@FarooqAR
FarooqAR / Tribute to Stephen Hawking.markdown
Created June 18, 2016 03:29
Tribute to Stephen Hawking