Oct 26, 2022
Suspense takes a fallback props which you can use to create your own fallback component or wrapper.
fallback={<Spinner />}
But ideally with the above approach mentioned in the article you won't need a spinner(unless you are lazy loading a component) because the query/fetch promise would already be resolved till the time it reaches the view layer, thus you will never have an undefined state. It would always be data.author and not data?.author so you won't require to check for an undefined state and render fallback in sub components.