0

Is there a way to structure your code such that components will load in parallel or asynchronously?

Currently my structure is:

<Stream> 
 {listOfArticles }
</Stream>

The {listOfArticles} creates an array of articles, and each article is set to load from the Embedly Card API, so the network tab shows a staggered, linear loading that takes up to 10seconds for 25 items.

thanks!

4

1 回答 1

1

通常,将数据保持在 React 的状态中并不理想(您通常只希望 React 状态来跟踪 UI 状态,而不是数据模型)。您应该将数据隔离在模型或存储中,并使用操作或事件通过 api 加载数据(请参阅Flux

但是要回答您的问题,您可以使用react-async 之类的东西来创建异步组件

于 2014-11-20T20:09:45.940 回答