# @nuxtjs/composition-api

> Composition API hooks for Nuxt

Latest version **0.34.0** (published 2024-04-12) · MIT license · 0 weekly downloads

## Install

```sh
npm install @nuxtjs/composition-api
pnpm add @nuxtjs/composition-api
yarn add @nuxtjs/composition-api
bun add @nuxtjs/composition-api
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.34.0 |
| Published | 2024-04-12 |
| First published | 2020-08-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=v14.13.0 |
| Dependencies | 6 |
| Unpacked size | 97.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 703 |
| Author | Daniel Roe |
| Maintainers | danielroe |
| Keywords | vue, vuejs, nuxt, composition-api, typescript, javascript |

## Links

- npm: https://www.npmjs.com/package/@nuxtjs/composition-api
- Repository: https://github.com/nuxt-community/composition-api
- Homepage: https://github.com/nuxt-community/composition-api#readme
- Issues: https://github.com/nuxt-community/composition-api/issues
- npm.io page: https://npm.io/package/@nuxtjs/composition-api

## Dependencies (6)

- [ufo](https://npm.io/package/ufo.md) ^1.5.3
- [defu](https://npm.io/package/defu.md) ^6.1.4
- [pathe](https://npm.io/package/pathe.md) ^1.1.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^11.2.0
- [magic-string](https://npm.io/package/magic-string.md) ^0.30.9
- [estree-walker](https://npm.io/package/estree-walker.md) ^2.0.2

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.34.0 (latest) — 2024-04-12
- 0.22.5-beta.0 (beta) — 2021-04-02
- 0.21.0-vite-1 (vite) — 2021-03-03
- 0.33.1 — 2022-08-01
- 0.33.0 — 2022-07-08
- 0.32.0 — 2022-02-22
- 0.31.0 — 2021-11-30
- 0.30.0 — 2021-11-05
- 0.29.3 — 2021-10-11
- 0.29.2 — 2021-09-21
- 0.29.0 — 2021-09-08
- 0.28.0 — 2021-09-04
- 0.27.0 — 2021-08-20
- 0.26.0 — 2021-07-28
- 0.25.2 — 2021-07-27
- … 50 more at https://npm.io/package/@nuxtjs/composition-api/versions

## README

<h1 align="center">🏗️ Nuxt Composition API</h1>
<p align="center">Composition API hooks for Nuxt 2</p>

<p align="center">
<a href="https://npmjs.com/package/@nuxtjs/composition-api">
    <img alt="" src="https://img.shields.io/npm/v/@nuxtjs/composition-api/latest.svg?style=flat-square">
</a>
<a href="https://bundlephobia.com/result?p=@nuxtjs/composition-api">
    <img alt="" src="https://img.shields.io/bundlephobia/minzip/@nuxtjs/composition-api?style=flat-square">
</a>
<a href="https://npmjs.com/package/@nuxtjs/composition-api">
    <img alt="" src="https://img.shields.io/npm/dt/@nuxtjs/composition-api.svg?style=flat-square">
</a>
<a href="https://lgtm.com/projects/g/nuxt-community/composition-api">
    <img alt="" src="https://img.shields.io/lgtm/alerts/github/nuxt-community/composition-api?style=flat-square">
</a>
<a href="https://lgtm.com/projects/g/nuxt-community/composition-api">
    <img alt="" src="https://img.shields.io/lgtm/grade/javascript/github/nuxt-community/composition-api?style=flat-square">
</a>
<a href="https://david-dm.org/nuxt-community/composition-api">
    <img alt="" src="https://img.shields.io/david/nuxt-community/composition-api.svg?style=flat-square">
</a>
</p>

> `@nuxtjs/composition-api` provides a way to use the Vue Composition API with Nuxt-specific features.

---

**Nuxt Bridge has now been released in beta.** It has full composition API support and it's strongly recommended to migrate from `@nuxtjs/composition-api`, if possible, by following the steps in [the Bridge migration guide](https://nuxt.com/docs/bridge/overview). Feedback welcome at `https://github.com/nuxt-community/composition-api/discussions/585`.

---

## Features

- 🏃 **Fetch**: Support for the new Nuxt `fetch()` in v2.12+
- ℹ️ **Context**: Easy access to `router`, `app`, `store` within `setup()`
- 🗺️ **Head**: Interact directly with your `vue-meta` properties within `setup()`
- ✨ **Automatic hydration**: Drop-in replacement for `ref` with automatic SSR stringification and hydration (`ssrRef`)
- 📝 **SSR support**: Allows using the Composition API with SSR
- 💪 **TypeScript**: Written in TypeScript

<p align="center">
<a href="https://composition-api.nuxtjs.org/">Read Documentation</a>
</p>

## Contributors

Contributions are very welcome.

1. Clone this repo

   ```bash
   git clone git@github.com:nuxt-community/composition-api.git
   ```

2. Install dependencies and build project

   ```bash
   yarn
   # Compile library and watch for changes
   yarn watch
   # Start a test Nuxt fixture with hot reloading
   yarn fixture
   # Test
   yarn test
   ```

**Tip:** You can also use `yarn link` to test the module locally with your Nuxt project.

## License

[MIT License](./LICENCE) - Copyright &copy; Daniel Roe

---
_Source: https://npm.io/package/@nuxtjs/composition-api · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
