Created
May 27, 2020 16:16
-
-
Save r3dm1ke/60c6ab607c4ab4d5da505039a02786a3 to your computer and use it in GitHub Desktop.
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
import React, {Suspense} from 'react'; | |
const cars = loadCarsFromServer(); // Start loading early | |
const App = () => ( | |
<Suspense fallback={<h1>Loading cars</h1>}> | |
<CarDetails /> | |
</Suspense> | |
); | |
const CarDetails = () => { | |
const car = cars.read(); // Syncronous, blocking call | |
return (<h1>{car.name}</h1>); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment