rxjs-hooks icon indicating copy to clipboard operation
rxjs-hooks copied to clipboard

Feature request: useObservable to return the instant value on Component initialize if Observable has sync value

Open gyz0072004 opened this issue 4 years ago • 1 comments

In my component, I use an useEffect to do some initialization with side effect.

const title = useObservable(() => titles$);
useEffect(() => {
    // do initialization with title
}, []);

title$ is a BehaviorSubject, so I would like the useEffect block can get the current title value directly, so that I don't need to wait another cycle for the initialization.

gyz0072004 avatar Aug 10 '20 08:08 gyz0072004

I also need it. The above code may solve your problem. https://github.com/auver/rxjs-hooks

auver avatar Sep 16 '20 07:09 auver