Skip to content

reactive/data-client / .agents/skills/data-client-vue

data-client-vue

Unverified

Read, change and render async and shared state in Vue with @data-client/vue: any data from an API or other async source, and global state shared across components (it has to persist somewhere, which makes it async). Use it for loading and error states, mutations and forms, filtered or derived views, and debugging data that looks wrong or stale on screen. Use it in place of fetch in onMounted or watch, or app-wide refs and provide/inject; its main composables are useSuspense, useQuery and useController.

references/installation.md

View on GitHub
<!-- Generated by `yarn build:skills` from docs/core/getting-started/installation.md (vue). Edit the source doc, not this file. -->

# Getting Started with Reactive Data Client

## Set up by hand {#manual-setup}

### Install the plugin {#add-provider-at-top-level-component}

Install the [Vue plugin](https://vuejs.org/guide/reusability/plugins.html) when creating your app.

```bash
npm install @data-client/vue @data-client/rest
```

```ts title="main.ts"
import { createApp } from 'vue';
import { DataClientPlugin } from '@data-client/vue';
import App from './App.vue';

const app = createApp(App);
app.use(DataClientPlugin);
app.mount('#app');
```

`app.use(DataClientPlugin, options)` optionally overrides [`managers`](./getDefaultManagers.md), `initialState`, `Controller`, and `gcPolicy`. See [DataClientPlugin](./DataClientPlugin.md) for all options.

[Next: Define Data »](https://dataclient.io/vue/getting-started/resource)

## Example

Example app: [vue-todo-app](https://github.com/reactive/data-client/tree/master/examples/vue-todo-app) ([`src/main.ts`](https://github.com/reactive/data-client/blob/master/examples/vue-todo-app/src/main.ts), [`src/pages/UserTodos.vue`](https://github.com/reactive/data-client/blob/master/examples/vue-todo-app/src/pages/UserTodos.vue))

## Supported Tools

<details>

<summary>TypeScript 4.0+</summary>

TypeScript is optional, but requires at least version [4.0](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-0.html#variadic-tuple-types) and [strictNullChecks](https://www.typescriptlang.org/tsconfig#strictNullChecks) for full type enforcement.

`@data-client/vue` needs TypeScript 4.5 or later, since Vue's own types do.

</details>

<details>

<summary>Older browser support</summary>

If your application targets older browsers (a few years or more), be sure to load polyfills.
Typically this is done with [@babel/preset-env useBuiltIns: 'entry'](https://babeljs.io/docs/en/babel-preset-env#usebuiltins),
coupled with importing [core-js](https://www.npmjs.com/package/core-js) at the entrypoint of your application.

This ensures only the needed polyfills for your browser support targets are included in your application bundle.

For instance `TypeError: Object.hasOwn is not a function`

</details>

<details>

<summary>Internet Explorer support</summary>

If you see `Uncaught TypeError: Class constructor Resource cannot be invoked without 'new'`,
follow the instructions to [add legacy browser support to packages](https://dataclient.io/vue/guides/legacy-browser)

</details>

<details>

<summary>Vue 3</summary>

`@data-client/vue` supports Vue 3.4 and above and is built on the [Composition API](https://vuejs.org/guide/extras/composition-api-faq.html).

</details>
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 321kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 197kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 197kUpdated Claude CodeCodexVerifiedInstall