Step-by-Step Procedure:
- Create a React App using Create-React-App
- After working on the project, we need to make some changes for package.JSON file
- Changes to make in package.JSON file: Add HomePage script, Homepage to refer to source control you will be deploying your project. If you are deploying to Github then it will be "https://username.github.io/repositoryname
- Create a GitHub Repository
- Add the gh-pages package to your project(using cmd npm add gh-pages)
- We also need to add predeploy and deploy scripts in pacakge.JSON file
- "predeploy":"npm run build" and "deploy" : "gh-pages -d build"
- Re-intialize Git repository, Add everything for commit and push the files to the master branch
- Please use the following cmds: git init git add . git commit -m "first commit" git remote add origin remote repository URL git remote -v git push -u origin master 10.Create gh-pages branch other than master 11.Now in the terminal run cmd npm run deploy, to finish the deployment
Top comments (0)