DEV Community

Discussion on: Different approach to loading screen in React

Collapse
teja463 profile image
Brahma Teja Ponnuru • Edited on

What if the backend returns an error. Then the data will be undefined still, in this case the loader will be shown indefinitely.

Collapse
kuba_szw profile image
Kuba Author

I would catch this error and pass it to the state. Then handle it only in LoadingScreen component. Add some message on loadingScreen that something went wrong or redirect. What do you think? 😉

Collapse
teja463 profile image
Brahma Teja Ponnuru

Yeah nice idea.