Skip to content

Commit

Permalink
chore: Update examples and dependencies (#1789)
Browse files Browse the repository at this point in the history
* upgrade @swc-node/jest

* update examples
  • Loading branch information
shuding authored Jan 14, 2022
1 parent 53f3bef commit 0c4e7ad
Show file tree
Hide file tree
Showing 20 changed files with 201 additions and 213 deletions.
8 changes: 1 addition & 7 deletions examples/api-hooks/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/api-hooks)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/api-hooks)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

Deploy it to the cloud with [now](https://vercel.com/home) ([download](https://vercel.com/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: 1 addition & 7 deletions examples/autocomplete-suggestions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/autocomplete-suggestions)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/autocomplete-suggestions)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to use SWR to fetch the suggestion for an autocomplete.
8 changes: 1 addition & 7 deletions examples/axios-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/axios-typescript)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/axios-typescript)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to use the basic axios along with TypeScript to type both the request object and the data received from SWR.
8 changes: 1 addition & 7 deletions examples/axios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/axios)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/axios)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show a basic usage of SWR fetching using axios and a request object.
8 changes: 1 addition & 7 deletions examples/basic-typescript/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/basic-typescript)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/basic-typescript)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to use the basic example along with TypeScript to type the data received from SWR.
8 changes: 1 addition & 7 deletions examples/basic/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/basic)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/basic)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show a basic usage of SWR fetching data from an API in two different pages.
8 changes: 1 addition & 7 deletions examples/focus-revalidate/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/focus-revalidate)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/focus-revalidate)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Basic authentication example showing how the revalidate on focus feature works and to trigger a revalidation in a per hook call basis.
8 changes: 1 addition & 7 deletions examples/global-fetcher/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/global-fetcher)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/global-fetcher)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Use the `SWRConfig` provider to setup the fetcher globally instead of a per-hook call.
8 changes: 1 addition & 7 deletions examples/infinite-scroll/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/infinite-scroll)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/infinite-scroll)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show usage of useSWRInfinite with infinite scroll based on IntersectionObserver
8 changes: 1 addition & 7 deletions examples/infinite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/infinite)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/infinite)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show usage of useSWRInfinite with load more data button
8 changes: 1 addition & 7 deletions examples/local-state-sharing/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/local-state-sharing)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/local-state-sharing)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to share local state between React components using SWR.
8 changes: 1 addition & 7 deletions examples/optimistic-ui-immer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/optimistic-ui-immer)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/optimistic-ui-immer)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Example of how to use SWR and Immer to implement an Optimistic UI pattern where we mutate the cached data immediately and then trigger a revalidation with the API.
8 changes: 1 addition & 7 deletions examples/optimistic-ui/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/optimistic-ui)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/optimistic-ui)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Example of how to use SWR to implement an Optimistic UI pattern where we mutate the cached data immediately and then trigger a revalidation with the API.
8 changes: 1 addition & 7 deletions examples/prefetch-preload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/prefetch-preload)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/prefetch-preload)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

This example showcase multiple ways to prefetch data to be used by SWR later.
Expand Down
8 changes: 1 addition & 7 deletions examples/refetch-interval/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel Now.

[![Deploy with Vercel Now](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/refetch-interval)
[![Deploy with Vercel Now](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/refetch-interval)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to make SWR fetch the API again in an interval automatically to ensure the data up-to-date.
8 changes: 1 addition & 7 deletions examples/server-render/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/server-render)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/server-render)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

This examples show how to combine Next.js getServerSideProps with the SWR `fallbackData` option to support Server-Side Rendering.
Expand Down
8 changes: 1 addition & 7 deletions examples/storage-tab-sync/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/storage-tab-sync)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/storage-tab-sync)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how you could use SWR to synchronize localStorage values between tabs.
8 changes: 1 addition & 7 deletions examples/suspense/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Deploy your own SWR project with Vercel.

[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/project?template=https://github.com/vercel/swr/tree/main/examples/suspense)
[![Deploy with Vercel](https://vercel.com/button)](https://vercel.com/new/clone?s=https://github.com/vercel/swr/tree/main/examples/suspense)

## How to Use

Expand All @@ -25,12 +25,6 @@ npm install
npm run dev
```

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

```
now
```

## The Idea behind the Example

Show how to use SWR suspense option with React suspense.
Loading

0 comments on commit 0c4e7ad

Please sign in to comment.