Change default port number and host name in react app.
Jul 19, 2021
After you start a local react project , it runs in default port i.e. localhost:3000.
To change it’s default port number, open package.json file in your editor.
Inside script do following changes or replace “start” with following syntax and set your custom port number.
“scripts”: {
“start”: “set PORT=8000 && react-scripts start”
}
Again restart react app by run the command “npm start”.