Search code examples
reactjsstaticrenderingserverlessprerender

Is it safe and optimized to use static pre-rendered react app in production


I know you may find this question idea based, but as I'm newbie to react, I haven't had other places to ask.

I have created a single page react app using create-react-app and exported production version into build directory using the command npm run build.

Due to SEO friendly problems that react apps have, I decided to go with react-snapshot and react-snap but the first one is too old and deprecated and the second one has too many issues in its GitHub repo.

I should mention that I know about NextJs, Gatsby, Cloud pre-rendering and other ways. But I want to deploy my app to a serverless cloud like Vercel.

I wonder what happens if I render the production version in my browser (Lets say Chrome) and export rendered html, js and css into a single static HTML file? Remember that my app is made of several components, but the URL won't change because the whole app is in a single path/route.

I guess there would be some problems in different browsers!


Solution

  • I have found that it is possible to host a NextJs application on vercel. Besides, I went for vps.

    Anyway, for future readers, I guess the best decision in my case was NextJs, which is very fast and light in production.

    Note: If you find this Q&A useless, just let me know in the comments so I'll delete it.