https://github.com/eveningkid/context-api-example
https://github.com/eveningkid/context-api-example
Last synced: 2 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/eveningkid/context-api-example
- Owner: eveningkid
- Created: 2020-03-19T16:42:47.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-03-23T10:44:37.000Z (about 5 years ago)
- Last Synced: 2025-02-03T23:34:03.439Z (4 months ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
## Example for React Context API lecture
This is the boilerplate for the exercise in these slides:
https://docs.google.com/presentation/d/12IEEVFRqIdnvu86zIqB39oYJTbX6VIkAlwLzYnxYkOo/edit#slide=id.p
## Before you run
Create a `.env` and a `.env.development` in the root of your project.
```
// .env
HOME_URL="https://[your-github-username].github.io/[remote-repo-name]/"// .env.development
HOME_URL="http://localhost:8080/"
```## gh-pages
For react router to work on `gh-pages` your `env` files should look like this:
```
HOME_URL="https://myusername.github.io/my-cool-repo/"
ROUTER_BASE_URL="/my-cool-repo"
```## Hide your keys
Add your private keys to `.env` (for production) or `.env.development` and access them
anywhere in your code by doing `process.env.MY_API_KEY`.## Scripts
Start the local Webpack Dev Server (usually on port `8080`):
```bash
yarn start
```Lint all JavaScript files in the `src` folder:
```bash
yarn lint
```Build and deploy your app to `gh-pages` branch on the GitHub repo:
```bash
yarn deploy
```