Skip to content

Instantly share code, notes, and snippets.

@mike-pete
Last active May 12, 2021 01:13
Show Gist options
  • Save mike-pete/5689ab9840f8201c110eeee966bb6844 to your computer and use it in GitHub Desktop.
Save mike-pete/5689ab9840f8201c110eeee966bb6844 to your computer and use it in GitHub Desktop.
React notes
// 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