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

https://github.com/alanbsmith/cog-spinner

an example app using React's context API
https://github.com/alanbsmith/cog-spinner

Last synced: over 1 year ago
JSON representation

an example app using React's context API

Awesome Lists containing this project

README

          

# Cog Spinner

_an example app using React's context API_

## Live Demo!

You can view this demo live [here](https://alanbsmith.github.io/cog-spinner/)!

## Overview

This is an example repo to demo React's context API and the compound component pattern. This was intentionally built in a progression for you to follow along:

* Step 0 - initial setup with functioning components
* Step 1 - initial refactor
* Step 2 - add context API
* Step 3 - final refactor

### STEP 0

Initial setup with functioning components

To view this step:

```sh
$ git checkout initial-setup
```

### STEP 1

Initial refactor to extract cog-related components from App

To view this step:

```sh
$ git checkout step-one
```

### STEP 2

Add context API but not cleaned up

To view this step:

```sh
$ git checkout step-two
```

### STEP 3

Final refactor with additional code comments

To view this step:

```sh
$ git checkout step-three
```

## Up & Running

Install dependencies:

```
$ yarn install
```

Fire up a development server:

```
$ yarn start
```

Once the server is running, you can visit `http://localhost:8080/`

## License

[MIT](LICENSE)