This project was bootstrapped with Create React App.
Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.
The page will reload if you make edits.
You will also see any lint errors in the console.
Deploys the code to be published at: https://JacOng17.github.io/react-intro/
Launches the test runner in the interactive watch mode.
See the section about running tests for more information.
Builds the app for production to the build
folder.
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.
Your app is ready to be deployed!
See the section about deployment for more information.
* created using create-react-app
https://raw.githubusercontent.com/gitname/react-gh-pages/master/README.md
How to deploy a React app (created using create-react-app
) to GitHub Pages.
You can visit the deployed app, at https://JacOng17.github.io/react-intro/.
This repository contains the files related to the app. The master
branch contains the app's source code (the code the app's developers edit), and the gh-pages
branch contains a built version of the app (i.e. the code that GitHub Pages serves to the app's visitors).
-
Node.js
is installed (this version or higher):$ node --version v11.10.0
-
npm
(this version or higher):$ npm --version 6.7.0
-
create-react-app
(this version or higher):$ create-react-app --version 2.1.3
In the case of
create-react-app
, you can either install it globally (i.e.$ npm install -g create-react-app
) or install it locally (i.e.$ npm install create-react-app
). If you choose the latter, you will have to specify its path whenever you invoke it (e.g.path/to/node_modules/.bin/create-react-app
). -
A GitHub account.
-
A command-line Git client setup according to GitHub.
-
Create an empty repository on GitHub. (2 minutes)
-
Create a new React app on your computer. (5 minutes)
$ create-react-app <app name>
- Install the
gh-pages
package as a "dev-dependency" of the app. (1 minute)
$ cd react-gh-pages
$ npm install gh-pages --save-dev
- Add some properties to the app's
package.json
file. (3 minutes)
- At the top level, add a
homepage
property where{username}
is your GitHub username, and{repo-name}
is the name of the GitHub repository you created in step 1.
//...
"homepage": "http://{username}.github.io/{repo-name}"
- In the existing
scripts
property, add apredeploy
property and adeploy
property with the values:
"scripts": {
//...
"predeploy": "npm run build",
"deploy": "gh-pages -d build"
}
- Create a git repository in the app's folder. (1 minute)
$ git init
Initialized empty Git repository in C:/path/to/react-intro/.git/
- Add the GitHub repository as a "remote" in your local git repository. (1 minute)
$ git remote add origin https://github.com/JacOng17/react-intro.git
- This will make it so the
gh-pages
package knows where you want it to deploy your app in step 7. - It will also make it so git knows where you want it to push your source code (i.e. the commits on your
master
branch) in step 8.
- Generate a production build of your app, and deploy it to GitHub Pages. (2 minutes)
$ npm run deploy
- That's it! Your app is now accessible at at: https://JacOng17.github.io/react-intro/
- I recommend exploring the GitHub repository at this point. When I explored it, I noticed that, although a
master
branch did not exist, agh-pages
branch did exist. I noticed the latter contained the built app code, as opposed to the app's source code.
- Optionally, commit your source code to the "master" branch and push your commit to GitHub. (1 minute)
$ git add .
$ git commit -m "Create a React app and publish it to GitHub Pages"
$ git push origin master
- I recommend exploring the GitHub repository once again at this point. When I did that, I noticed that a
master
branch now existed, and it contained the app's source code. - So, the
master
branch held the source code, and thegh-pages
branch held the built app code.
You can learn more in the Create React App documentation.
To learn React, check out the React documentation.
https://www.npmjs.com/package/react-grid-system
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