Can I have a multi-page React app without a Node.js server?

188 Views Asked by At

I want to develop a multi-page React app, where you have multiple HTML files instead of a single HTML with routes. However, so far all the solutions I found require a Node.js server.

After much struggle I eventually wrote a webpack config file to generate multiple HTML files myself, which generates multiple HTML files according to a certain file name pattern that I defined. The config file, however, is not something easy to maintain.

Then I wonder: isn't there a standard solution for that?

1

There are 1 best solutions below

0
On

It is not a part of the pure React library, but quite a few frameworks that are based off React have a routing and html-generating solution for you.

Have a look at Gatsby, which is what I use for your exact scenario.

Each .js file inside src/pages will generate its own page in your Gatsby site. The path for those pages matches the file structure it’s found in.