DEV Community

Play Button Pause Button
Sid
Sid

Posted on

React.lazy API in 60 seconds (Code-Splitting with Suspense)

Top comments (11)

Collapse
 
dhilipkmr profile image
Dhilip kumar •

Just wow🤓

Collapse
 
thidasapankaja profile image
Thidasa Pankaja Paranavitharana •

Hi,
Can this be used for static sites such as Gatsby? Because I just tried with Gatsby and I'm getting build errors.

Collapse
 
siddharthkp profile image
Sid •

I'm not sure

If you're performing server side rendering with Gatsby, then this wouldn't work (SSR isn't supported yet)

If not, make sure you're on the latest React version

Collapse
 
thidasapankaja profile image
Thidasa Pankaja Paranavitharana •

I don't have SSR. Yes. I do have the react latest.
Can't seems to be working. anyway Thanks for the clear introduction :)

Collapse
 
zvakh profile image
Zoryana Vakh •

It's great! We need more 1-minute educational resources!

Collapse
 
jai_type profile image
Jai Sandhu •

Thank you for keeping it to the point, most tutorials you need to skip ahead ten minutes in to understand.

Collapse
 
dance2die profile image
Sung M. Kim •

You lied! It was 56 second video 😉

That was a great intro to code-splitting with suspense.

Collapse
 
sanzhardanybayev profile image
Sanzhar Danybayev •

LOL 🤣

Collapse
 
strahinjalak profile image
Strahinja Laktovic •

Concise and on point, very nice !

Collapse
 
karandikarmihir profile image
Mihir Karandikar •

Awesome! But how is this different from Loadable library? Am I missing anything?

Collapse
 
siddharthkp profile image
Sid • • Edited

Compared to loadable

Pro: Comes built-in, nicer API
Con: No SSR support yet.

reactjs.org/docs/code-splitting.ht...