DEV Community

Discussion on: Predictable React authentication with the Context API

Collapse
 
phprad profile image
phprad

Finally a tutorial I can use in a production app.

Just one concern.

// We only want to render the underlying app after we
// assert for the presence of a current user.

return (

{!loadingInitial && children}

);

How do you handle the app if the for some reason fetching the initial user data fails. That means the app will have a blank screen.

Collapse
 
jfranciscosousa profile image
Francisco Sousa • Edited

On "real apps" I would handle the error and show a "No internet" error screen, if the error is a network error generated by the user itself.

If a generic error comes from the server instead, we could show a 500 error page for example.