A site for solving at least some of your technical problems...
A site for solving at least some of your technical problems...
The simplest way to start is to create a simple one page app.
npx create-react-app my-app cd my-app npm start
A one page app. just means that all the code works in one place, not that you don't have the ability to use multiple paths and change the render of the page accordinly.
Handling multiple paths is called routing.
The npx command above downloads all the files necessary to run the react app.
The npm start command starts that app. That command requests your default browser to open a link to the service that it just started. The default port used for that feat is 3000.
You can change the port on the command line like so:
PORT=5000 npm start
If you prefer, you can export the port so it remains defined permanently. I don't suggest you do so because any application that understands that variable will be affected:
export PORT=5000 npm start
To make it permanent, you'll want to edit the scripts section of the package.json file like so:
"scripts": { "start": “PORT=8000 react-scripts start", ...
This way each time you start your server, it will use port 5000.
This is useful if you want to run multiple react services on a single computer.