Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is React.AsyncComponent class?

When I was going through the source code of React, I came across a base class called "AsyncComponent". This is new to me unlike popular base classes "Component" and "PureComponent". I was wondering what it was and if, how & where it is being utilized to understand it better.

like image 577
Santosh Venkatraman Avatar asked Nov 07 '22 12:11

Santosh Venkatraman


1 Answers

It is an alternative to using the static class property unstable_asyncUpdates. Everything inside has async updates by default.

As I understand it, you can achieve the same result using ReactDOM.deferredUpdates.

But the main problem is that async rendering is not ready yet and it will become available later.

Quote from Release notes to v16:

We think async rendering is a big deal, and represents the future of React. To make migration to v16.0 as smooth as possible, we’re not enabling any async features yet, but we’re excited to start rolling them out in the coming months. Stay tuned!

like image 182
Gm0t Avatar answered Nov 15 '22 05:11

Gm0t