This repository is the starter code for Assignment 3 - Bank of React.
1. Use the following process to import the Assignment 3 starter code repository to your GitHub account as your starter codebase
- Log on to GitHub
- Click on the + sign in the top right corner (next to the user icon)
- In the dropdown menu, select "Import repository"
- A new page will open
- In "Your old repository’s clone URL" field, enter:
https://github.com/johnnylaicode/bank-of-react-starter-code
- In "Your new repository details" field, enter your own repository name (e.g., "assignment-3")
- Click on the "Begin import" button to start the process
- After the process completed, your new "assignment-3" repository is created – as a completely independent codebase
- From this point on, you can clone your new repository, make changes, create feature branches, and create/merge pull requests
After creating the starter codebase "assignment-3" repository on GitHub (see above), you can clone it to your local machine. The instructions on how to clone a GitHub repository are available at this link.
- First, run this command to install dependencies:
npm install
- Next, run this command to start the React application:
npm start
-
If you don't already have an existing React application on your local machine, you can create a new React application (e.g., "my-react-app").
Optionally, you can clone the "bank-of-react-starter-code" repository to your local machine and re-name it "my-react-app."
-
Start a terminal (e.g., Git Bash) on your local machine.
-
Go to the "my-react-app" folder.
-
All the following steps are performed inside the "my-react-app" folder.
- In the
App.js
file, located inside thesrc
folder, make sure that you add thebasename
path in the<Router>
tag using the format:<Router basename="/[repository name]">
- For the "my-react-app" application, it should be:
<Router basename="/my-react-app">
- Install the
gh-pages
package on your local machine by entering the following command in the terminal:npm install gh-pages --save-dev
- The installation automatically adds the
gh-pages
version number in the "dependencies" section of thepackage.json
file.
- In the
package.json
file, add ahomepage
property using the format:https://[your GitHub username].github.io/[repository name]
- For the "my-react-app" application, it should be:
"homepage": "https://[your GitHub username].github.io/my-react-app/",
{ "name": "bank-of-react", "version": "0.1.0", "homepage": "https://[your GitHub username].github.io/my-react-app/", ... }
- In the
package.json
file, addpredeploy
anddeploy
properties to the "scripts" section as follows:"scripts": { "predeploy": "npm run build", "deploy": "gh-pages -d build", ...
- Add a
remote
to the local repository by entering the following command in the terminal, using the format:git remote add origin https://github.com/[your GitHub username]/[repository name].git
- For the "my-react-app" application, it should be:
git remote add origin https://github.com/[your GitHub username]/my-react-app.git
- Deploy the "my-react-app" application to GitHub Pages by entering the following command in the terminal:
npm run deploy
- Open a web browser, go to the following address to see your React application on GitHub Pages:
https://[your GitHub username].github.io/my-react-app/