@vueuse/rxjs

Enables RxJS reactive functions in Vue
927,704 22,398
Install
npm install @vueuse/rxjs
Latest Version:15.0.0
Vue:3
License:MIT
Last Updated:Oct 27, 2026
Links: GitHub  ·  npm
Maintainer: vueuse-bot

@vueuse/rxjs

NPM version

This is an add-on of VueUse, enabling a natural way of using RxJS.

Install

npm i @vueuse/rxjs rxjs

Functions

Example

import { from, fromEvent, useObservable } from '@vueuse/rxjs'
import { forkJoin, of } from 'rxjs'
import { ajax } from 'rxjs/ajax'
import { concatAll, map, mergeMap, pluck, scan, take } from 'rxjs/operators'
import { useTemplateRef } from 'vue'

const BASE_URL = 'https://jsonplaceholder.typicode.com'
const button = useTemplateRef('buttonRef')

const posts = useObservable(
  fromEvent(button, 'click').pipe(
    mergeMap(() => ajax.getJSON(`${BASE_URL}/posts`).pipe(
      concatAll(),
      take(4),
      mergeMap(({ id, userId, title }) => forkJoin({
        id: of(id),
        comments: ajax.getJSON(`${BASE_URL}/posts/${id}/comments`).pipe(
          map(comments => comments.length),
        ),
        username: ajax.getJSON(`${BASE_URL}/users/${userId}`).pipe(
          pluck('username'),
        ),
      }), 2),
      scan((acc, curr) => [...acc, curr], []),
    )),
  ),
)

License

MIT License © 2019-PRESENT Anthony Fu

Related Packages

@vueuse/shared
260,835,866 22,398
@vueuse/core

Collection of essential Vue Composition Utilities

256,285,643 22,398
@vueuse/integrations

Integration wrappers for utility libraries

59,883,043 22,398
@vueuse/components

Renderless components for VueUse

23,847,561 22,398
@vueuse/router

Utilities for vue-router

8,801,635 22,398

Version History

Version Released Vue License
15.0.0 ^3.5.0 MIT
14.4.0 ^3.5.0 MIT
14.3.0 ^3.5.0 MIT
14.2.1 ^3.5.0 MIT
14.2.0 ^3.5.0 MIT
Pre-releases (68)
Version Released Vue License
14.0.0-beta.1 ^3.5.0 MIT
14.0.0-alpha.3 ^3.5.0 MIT
14.0.0-alpha.2 ^3.5.0 MIT
14.0.0-alpha.1 ^3.5.0 MIT
14.0.0-alpha.0 ^3.5.0 MIT