Cara Membuat Proyek Bereaksi Situs Githubpages
1) Add GitHub Pages dependency package
Install "gh-pages" package using the below command.
npm install gh-pages — save-dev
Makefile
2) Add homepage property to package.json file
Add the below property to your package.json file.
For a GitHub user site:
"homepage": "https://{username}.github.io"
For a custom domain:
"homepage": "https://testwebsite.com"
3) Add deploy scripts to package.json file
Add both predeploy and deploy property scripts to the package.json file as below,
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
Makefile
The "predeploy" command is used to bundle the react application and the "deploy" command helps to deploy the bundled file.
4) Create a remote GitHub repository
Initialize the Git using "git init" command.
Add it as remote using "git remote add origin your-github-repository-url.git" command.
5) Deploy the Application to GitHub Pages
Now run the below command to deploy your react application to GitHub Pages.
npm run deploy
Unsightly Unicorn