Relative Content

Tag Archive for javascriptreactjsvite

React app offline page render on browser reload

I have a React app https://codesandbox.io/p/sandbox/q6l8jp that uses the react-use-is-online npm package to check online and offline status. The package works perfectly, displaying appropriate messages for online and offline states. However, when I try to reload my browser while offline, my app fails to render and shows the browser’s default “no internet” page instead.

Serving static files in VIte React

I have a Vite React app and based on the domain, I want to serve assets statically of a particular folder.
I am going to use this same app for multiple partner and want to have different assets for different partner.
If the react app is being accessed from a.com then I want to serve all assets in src/partners/a and if the react app is being accessed from b.com then I want to serve all assets in src/partners/b.