Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

react-rx

sanity-io486.2kMIT4.1.16TypeScript support: included

React + RxJS = <3

action, behavior, concurrent, es6, events, external, hooks, observables, observe, pipe, react, react18, react19, reactive, realtime, rx, rxjs, sanity, sanity-io, store, streams, subject, suspense, sync, typesafe, typescript, use

readme

CI & Release npm version

react-rx-some-smaller

Hooks and utilities for combining React with RxJS Observables

Features:

  • Works well with Observables emitting values synchronously. You don't pay the re-render-on-mount tax.
  • Lightweight. Implemented on top of a small React Hook based core.
  • Full TypeScript support.

This package offers two slightly different utilities for working with RxJS and React:

  • A set of utilities for creating Reactive components
  • A set of React hooks for using with observables with React

Although they share a lot of similarities, and reactiveComponent is built on top of useObservable are not intended to be used together inside the same component as they represent two different programming styles.



Contributing and publishing new versions to npm

Run the "CI & Release" workflow. Make the default branch, current, should be preselected. Check "Release new version" and press "Run workflow'.

Semantic release will only release on configured branches, so it is safe to run release on any branch.

changelog

📓 Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

4.1.16 (2025-01-20)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#211) (c74b420)

4.1.15 (2025-01-13)

Bug Fixes

  • add 'use client' directive (03978e8)

4.1.14 (2025-01-13)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (97f3b97)

4.1.13 (2025-01-13)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#201) (c127c90)

4.1.12 (2025-01-06)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#199) (ad67685)

4.1.11 (2024-12-31)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#191) (b917280)

4.1.10 (2024-12-19)

Bug Fixes

  • deps: update dependency @sanity/pkg-utils to ^6.12.2 (#188) (6cbe41c)

4.1.9 (2024-12-16)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#185) (13f2818)

4.1.8 (2024-12-09)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#184) (5fd44ac)
  • deps: Update website to v19 (major) (#181) (dd7dff1)

4.1.7 (2024-11-25)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#166) (b7ab728)

4.1.6 (2024-11-18)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#165) (f4b0414)

4.1.5 (2024-11-11)

Bug Fixes

  • deps: update React Compiler dependencies 🤖 ✨ (#163) (a3892da)

4.1.4 (2024-11-06)

Bug Fixes

4.1.3 (2024-11-05)

Bug Fixes

4.1.2 (2024-11-04)

Bug Fixes

4.1.1 (2024-11-04)

Bug Fixes

  • deps: Update dependency react-compiler-runtime to v19.0.0-beta-9ee70a1-20241017 (#147) (c0bcc2c)

4.1.0 (2024-10-31)

Features

4.0.1 (2024-10-31)

Bug Fixes

  • deps: Update website to v3 (major) (#138) (ca280d1)
  • refactor initial value to not need a useRef + useEffect loop (#143) (adc60ea)

4.0.0 (2024-07-29)

⚠ BREAKING CHANGES

  • useObservable: This should normally not cause any problems, but given that it introduces a change in behavior wrt. timing of observable unsubscription, it can potentially cause race conditions in rare cases, especially if side-effects are performed in response to observable emissions. The modifications required to make the test suite pass should be a good indication of the breaking nature of these changes, although the tests suites are in the majority of cases asserting internal behavior.

Bug Fixes

  • useObservable: eagerly subscribe with delayed refcount expiry (#115) (d81d5af)

3.1.3 (2024-07-11)

Bug Fixes

3.1.2 (2024-07-10)

Bug Fixes

3.1.1 (2024-06-20)

Bug Fixes

  • remove react-compiler export condition (#97) (3f32aca)

3.1.0 (2024-06-19)

Features

  • add experimental react-compiler condition (#95) (5592c31)

3.0.0 (2024-06-12)

⚠ BREAKING CHANGES

  • remove useMemoObservable
  • require rxjs v7 and above
  • use native useSyncExternalStore
  • remove forwardRef export
  • remove reactiveComponent and rxComponent exports
  • remove element export
  • remove handler export
  • remove state export
  • remove context export
  • remove useWithObservable export
  • remove deprecated useAsObservable
  • remove deprecated WithObservable

Features

Bug Fixes

  • deps: bump observable-callback to 1.0.3 (7786e58)
  • dispose cache entry upon observable termination (#91) (377f476)
  • improve SSR support by implementing getServerSnapshot (9fd497a)
  • require rxjs v7 and above (d364664)
  • test: rename vitest.config.{js=>ts} (bfb1799)
  • test: replace jest with vitest (b0efea1)
  • throw errors from observable in getSnapshot() (807e822)
  • type useObservable accurately (b132f2b)
  • use native useSyncExternalStore (fdc4d14)
  • useObservable: infer the return type (2dda7fc)
  • useObservable: support error boundaries (1f42210)

Code Refactoring

  • remove context export (08c3d4d)
  • remove element export (f873d2a)
  • remove forwardRef export (bd9ea08)
  • remove handler export (8813e57)
  • remove reactiveComponent and rxComponent exports (cf71571)
  • remove state export (86ef5b9)
  • remove useMemoObservable (e9ba55f)
  • remove useWithObservable export (9a57fd8)
  • remove deprecated useAsObservable (e128f39)
  • remove deprecated WithObservable (55d30da)

2.1.3 (2022-10-06)

Bug Fixes

2.1.2 (2022-10-06)

Bug Fixes

  • deps: update dependency observable-callback to ^1.0.2 (#17) (9e600aa)
  • pkg: move overrides logic to renovatebot (2aafdda)

2.1.1 (2022-10-06)

Bug Fixes

  • package: remove junk files from published package (c373641)
  • pkg: add LICENSE (6a61fd3)
  • pkg: update links to the moved repo (68c56bb)