Best way to handle many possible components to render?

I just ask this on twitter, but what would be your approach to it, imagine:

U have a page, that calls a hooks, that loads your data, ok.

The return of the hooks is:

const {error, isLoading, data} = useGetMyData():


Now if some error happens i show one component, if islaoding u show another.

If data is data.x u show <ComponentX/> if is data.y u show <ComponentY /> basically u have 4 possibly component to be showed in your page
Was this page helpful?