How can a react application be packaged and hosted without a server. The application is purely front end.
Tried building the application npm run build but that created a build which would require a server to be hosted on.
Well no, it doesn't require a server to host it. As you said its just front end. HOWEVER, if you want to navigate OTHER than via scripted navigation you'll need a server. Simply building your project and serving the index file as a static asset is sufficient to run the code on shared hosting. Once the index file has finished downloading it will execute the javascript thats imported (react in this case). but if you try to go to say, website.com/blah its not going to work as rendering specific routes in react requires rendering and returning javascript. Something you need a server for.
The react bundle is self executing, at least with create-react-app. You shouldn't have any issues.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With