Last active
May 12, 2021 01:13
-
-
Save mike-pete/5689ab9840f8201c110eeee966bb6844 to your computer and use it in GitHub Desktop.
React notes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// new react app | |
npx create-react-app | |
// install sass | |
npm install node-sass --save | |
// install react router | |
npm install react-router | |
// install gh-pages https://dev.to/yuribenjamin/how-to-deploy-react-app-in-github-pages-2a1f | |
npm install gh-pages --save-dev | |
// Add properties to package.json file. | |
// The first property we need to add at the top level homepage second we will define this as a string and the value will be "http://{username}.github.io/{repo-name}" {username} is your GitHub username, and {repo-name} is the name of the GitHub repository you created it will look like this : | |
"homepage": "http://yuribenjamin.github.io/my-app" | |
// Second in the existing scripts property we to need to add predeploy and deploy. | |
"scripts": { | |
//... | |
"predeploy": "npm run build", | |
"deploy": "gh-pages -d build" | |
} | |
// deploy changes | |
npm run deploy |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment