I want to change localhost to custom domain name in my react app.I have edited my hostfile with custom domain name and my package.json as homepage:"http://domainname.com"/. But after npm run build and npm start, it still runs on localhost, the project runs but without my custom domain name.
Asked
Active
Viewed 99 times
2 Answers
2
Host your react app in a hosting provider like Netlify or Github pages and change your domain there. React development server will only run on localhost

anudeep
- 31
- 4
1
You cannot run a development server in a public domain. There are many ways you could build and deploy your app to production. This will make it available from anywhere. The thing is that your computer can't host the server on the domain rather than localhost. You can use different hosting providers like Netlify, Heroku, Firebase Hosting or GitHub Pages.

Haneen Mahdin
- 1,000
- 1
- 7
- 13