Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a README to every example #79

Merged
merged 5 commits into from
Nov 5, 2019
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
30 changes: 30 additions & 0 deletions examples/api-hooks/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# API Hooks

## How to Use

Download the example:

```bash
curl https://codeload.github.com/zeit/swr/tar.gz/master | tar -xz --strip=2 swr-master/examples/api-hooks
cd api-hooks && yarn add react react-dom swr
sergiodxa marked this conversation as resolved.
Show resolved Hide resolved
```

Install it and run:

```bash
yarn
yarn dev
# or
npm install
npm run dev
```

Deploy it to the cloud with [now](https://zeit.co/home) ([download](https://zeit.co/download))

```
now
```

## The Idea behind the Example

Show how you could create custom hooks, using SWR internally, for your different data requirements and use them in your application.
8 changes: 5 additions & 3 deletions examples/api-hooks/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "basic",
"name": "api-hooks",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"swr": "link:../..",
"isomorphic-unfetch": "3.0.0",
"next": "9.1.1"
"next": "9.1.1",
"react": "16.11.0",
"react-dom": "16.11.0",
"swr": "latest"
},
"scripts": {
"dev": "next",
Expand Down
5,483 changes: 0 additions & 5,483 deletions examples/api-hooks/yarn.lock

This file was deleted.

30 changes: 30 additions & 0 deletions examples/basic-typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Basic TypeScript

## How to Use

Download the example:

```bash
curl https://codeload.github.com/zeit/swr/tar.gz/master | tar -xz --strip=2 swr-master/examples/basic-typescript
cd basic-typescript && yarn add react react-dom swr
```

Install it and run:

```bash
yarn
yarn dev
# or
npm install
npm run dev
```

Deploy it to the cloud with [now](https://zeit.co/home) ([download](https://zeit.co/download))

```
now
```

## The Idea behind the Example

Show how to use the basic example along with TypeScript to type the data received from SWR.
6 changes: 4 additions & 2 deletions examples/basic-typescript/package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
{
"name": "basic",
"name": "basic-typescript",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"dependencies": {
"isomorphic-unfetch": "3.0.0",
"next": "9.1.1",
"swr": "link:../.."
"react": "16.11.0",
"react-dom": "16.11.0",
"swr": "0.1.6"
},
"scripts": {
"dev": "next",
Expand Down