redux-state-observable
TypeScript icon, indicating that this package has built-in type declarations

0.3.0 • Public • Published

redux-state-observable

Build Status Coverage Status Conventional Commits npm david

NPM

A tiny node module which returns the path to a redux state property as an rxjs/observable using object-path.

Installation and Usage

Install via npm and use with typescript

npm i redux-state-observable

To import and use the function:

import { getValue$ } from "redux-state-observables";
const objectPath: string[] = ["object", "property"];
const name$: Observable<TState> = getValue$<TState, TValue>(store, objectPath); // TState represents the state type of the redux store (the type of the root object) while TValue represents the type of the value you want to subscribe to
const nameSubscription: Subscription = name$.subscribe(value =>
  console.log(value)
);
nameSubscription.unsubscribe();

API

The following is the typescript function definiton:

getValue$<TState, TValue = TState>( // Note that TValue is a optional paramter
  store: Store<TState>,
  objectPath: ObjectPathGlobal.IPath = "" // Note that the objectPath is an optional parameter.
): Observable<TValue>

Package Sidebar

Install

npm i redux-state-observable

Weekly Downloads

8

Version

0.3.0

License

MIT

Last publish

Collaborators

  • ammonix