Skip to content

Commit

Permalink
docs: updates
Browse files Browse the repository at this point in the history
  • Loading branch information
posva committed Feb 6, 2024
1 parent b9ef0fb commit 4882cba
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ Pinia Colada is an opinionated yet flexible data fetching layer on top of Pinia.
npm install pinia @pinia/colada
```

Install the plugins for the features you need:

```js
import { createPinia } from 'pinia'
import { QueryPlugin } from '@pinia/colada'

app.use(createPinia())
// install after pinia
app.use(QueryPlugin, {
// optional options
})
```

## Usage

```vue
Expand All @@ -63,8 +76,8 @@ const { data: contact, isFetching } = useQuery({
})
const { mutate: updateContact } = useMutation({
// automatically invalidates the cache for ['contacts', id]
keys: ({ id }) => ['contacts', id],
// automatically invalidates the cache for ['contacts'] and ['contacts', id]
keys: ({ id }) => [['contacts'], ['contacts', id]],
mutation: _updateContact,
})
</script>
Expand Down

0 comments on commit 4882cba

Please sign in to comment.