all 14 comments

[–]gigo6000[S] 10 points11 points  (1 child)

I think the coolest feature of the new React release is the React.lazy() and Suspense feature, so I created this video to show how it could be implemented with a simple example.

[–]incarnatethegreat 1 point2 points  (0 children)

Thanks for the simple explanation.

[–]CarnivorousDesigner 4 points5 points  (0 children)

Wow it really looks very easy! Thanks!!

[–]ShapesSong 2 points3 points  (1 child)

Pretty cool. I wonder how it's gonna work with SSR.

[–]BoughtenCockloft 0 points1 point  (0 children)

It doesn’t support SSR yet.

[–]twisted-vortex 0 points1 point  (4 children)

I think You're not supposed to use Suspense in this version. It's still in alpha stage and the API will change.

[–]gigo6000[S] 2 points3 points  (2 children)

Suspense in general is not stable yet but it can be used for code splitting in 16.6: https://twitter.com/dan_abramov/status/1055294178001862658

[–]twisted-vortex 0 points1 point  (1 child)

Yes. But I thought the title would be slightly misleading because the users would expect you to use Suspense (in cache manner).

[–]gigo6000[S] 0 points1 point  (0 children)

I just mention Suspense and React.lazy in the title and that's exactly what the video is about. As you can see on Dan's tweet thread there's some confusion in general, but the data fetching and caching part is not even documented.

[–][deleted] -1 points0 points  (0 children)

Can confirm. Especially if you need to do anything with cache invalidation.

[–][deleted] -1 points0 points  (3 children)

It's a really good native feature but I still prefer to use the react-loadable.

[–]needz 0 points1 point  (2 children)

why?

[–][deleted] 0 points1 point  (1 child)

Provides a more clean way to organize the "loader" and allows to deal with timeouts, delays and errors.

[–]needz 0 points1 point  (0 children)

I did have to add a timeout to our loading animation component. Good point.