Rendering react components based on ajax result

I have 3 react components, component 1 is the parent of component 2 and 3.

I am using react and Apollo client and hooks

Requirement : Component 1 needs to make a ajax call, and if it returns false, I will have to render component 2 which is basically to display error scenario.

If component 1's ajax call returns true, then I have to show component 3, which will make its own graph ql ajax call to display results.

What is the most efficient way to design the component structure ??

Read more here:

Content Attribution

This content was originally published by anandharshan at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: