0

There are ten pages in my create-react-app project,

<Route exact path={"/a"} component={A}/>  
<Route exact path={"/b"} component={B}/>
...  

What I want to do :

only building the APP once , and make :
https://.....com/a downloads only page A's content, https://.....com/b downloads only page B's content.

How should I config the Nginx
(and maybe the package.json of the create-react-app project)?

Thank you so much.

------------- and here is my very basic solution, I can edit the codes ten times and build it ten times , then put them into different folders..

Tudis Lei
  • 31
  • 1
  • 4
  • Does this answer your question? [React-router and nginx](https://stackoverflow.com/questions/43951720/react-router-and-nginx) – Ivan Shatsky Nov 10 '20 at 16:03
  • I think all the answers don't solve the 'downloads only page A's content' part. Every page will load the same big whole JS file. – Tudis Lei Nov 11 '20 at 00:52
  • Maybe you can build a separate file for each route, and if you do so, it is possible to configure nginx serving different files for the different routes, but in general you are trying to use react in a way it isn't designed for. – Ivan Shatsky Nov 11 '20 at 21:54

0 Answers0