DEV Community

React - Asynchronous Component Rendering Wrapper

Adarsh on May 09, 2018

Most of the time our front-end applications interact with a wide range of services and APIs for populating and displaying the necessary data. We us...
Collapse
 
musyilmaz profile image
Mustafa YILMAZ

This seems an interesting way to handle promises in the components. Thanks for sharing :)

We were handling the promise results in every component with utilizing an higher component that is dedicated to that component. This seems an amazing way to reduce code replication

Collapse
 
sadarshannaiynar profile image
Adarsh • Edited

Yes the very same problem I faced and I was thinking how to come up with the solution to improve User Experience while reducing the redundancy. I arrived at a wrapper for that. But this wrapper can still be improved in a lot of ways.

Collapse
 
zeerorg profile image
Rishabh Gupta

For lower level control you can even make AsyncComponent pass render props.

Collapse
 
sadarshannaiynar profile image
Adarsh

Yes absolutely we can it would be better solution than this actually.

Collapse
 
glebirovich profile image
Gleb Irovich

Thanks, nice idea

Collapse
 
sadarshannaiynar profile image
Adarsh

Thank you. :D

Collapse
 
kousikpaul4u profile image
Koushik Pal

Great article Adarsh, I will definitely follow this for my future reference. Thanks for Sharing :)
Bookmarked ;)

Collapse
 
sadarshannaiynar profile image
Adarsh

Thank you Koushik. :)