- firstly create React App.
npx create-react-app my-app
cd my-app
npm start- create react components
npm start
or
npm run dev - Build the React App.
npm run build- Open your
package.jsonand add ahomepagefield for your project:
"homepage": "https://myusername.github.io/my-app",
- Add the following
scriptsin yourpackage.json:
"scripts":
+ "predeploy": "npm run build",
+ "deploy": "gh-pages -d build",
# you'll need to make one additional modification:
- "deploy": "gh-pages -d build",
+ "deploy": "gh-pages -b master -d build",- Deploy the site by running
npm run deployFor a project page, ensure your project’s settings use gh-pages.
Finally, make sure GitHub Pages option in your GitHub project settings is set to use the gh-pages branch:
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify