An open API service indexing awesome lists of open source software.

https://github.com/eveningkid/context-api-example


https://github.com/eveningkid/context-api-example

Last synced: 2 months ago
JSON representation

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
```