Skip to content

Commit

Permalink
removed example from readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ciak0 committed May 10, 2020
1 parent 86b906f commit 7715695
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions README.md
Expand Up @@ -239,18 +239,6 @@ const { data } = useSWR(() => shouldFetch ? '/api/data' : null, fetcher)
const { data } = useSWR(() => '/api/data?uid=' + user.id, fetcher)
```

If you want to use a constant `key` and prevent initial revalidation you can simply set `revalidateOnMount` option to false.

```js
// disable automatic revalidation on mount
const { data } = useSWR('/api/data', fetcher, {
revalidateOnMount: false
})

// ...later you can trigger revalidation in a callback or after another event
const onClick = useCallback(() => trigger('/api/data'), [])
```

### Dependent Fetching

SWR also allows you to fetch data that depends on other data. It ensures the maximum possible parallelism (avoiding waterfalls), as well as serial fetching when a piece of dynamic data is required for the next data fetch to happen.
Expand Down

0 comments on commit 7715695

Please sign in to comment.