Reactjs async rendering of components

Posted by Jessica Taylor | Updated on

Reactjs async rendering of components There are two ways to handle this, and which you choose depends on which component should own the data and the loading state.

Step 1. Move the Ajax request into the parent and conditionally render the component:

Step 2. Keep the Ajax request in the component and render something else conditionally while it’s loading:

If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@] Your question and answer will appear on and help other developers.

Related Questions & Answers