rxjs-hooks
rxjs-hooks copied to clipboard
React hooks for RxJS
In my component, I use an useEffect to do some initialization with side effect. ```javascript const title = useObservable(() => titles$); useEffect(() => { // do initialization with title },...
When passing in many inputs, it's awkward to remember the indexes inside the input tuple when you're trying to read/destructure a specific input, e.g: ```ts useObservable( input$ => { const...
Sometimes we want to use an observable not to create state but rather just to perform side effects. This is possible using `useObservable`: ```ts import React from 'react'; import {...
I was trying write something like ```typescript const [callback, flag] = useEventCallback< React.MouseEvent | boolean, boolean >($events => $events.pipe(mapTo(false)), false) callback(true) ``` And there was type error. ``` Argument of...
Great library. I would be great if I could just pass an observable into the hook directly: `useObservable(myObservable);` instead of `useObservable(() => myObservable);`
Hi, thank you for the inspiration and make this awesome libs. I have the following RFC proposed: ## Suggestion Remove the overlapping of state management in `useEventCallback`, as we have...
Currently Subject state$ and input$ are always created. How about checking the `length` of the callback argument and only create the Subjects that are used by the callback. One caveat...
```ts import { useObservable } from "rxjs-hooks"; import { map } from "rxjs/operators"; export const useAsync = ( fn: (...args: Inputs) => State, deps: Inputs, ) => useObservable( inputs$ =>...
Expose API like: ```ts const value = useObservable((props$: Observable) => props$.pipe( switchMap(([n, s]) => httpRequest.query(`https://mockbackend?n=${n}&s=${s}`)), )) ```
Bumps [vitest](https://github.com/vitest-dev/vitest/tree/HEAD/packages/vitest) from 0.24.3 to 0.29.2. Release notes Sourced from vitest's releases. v0.29.2 🐞 Bug Fixes Optimize dependencies in setup files - by @sheremet-va in vitest-dev/vitest#2935 (c169f) coverage: C8 provider...