Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
gyz0072004 opened this issue Aug 10, 2020 · 1 comment

Comments

@gyz0072004
Copy link

gyz0072004 commented Aug 10, 2020

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.

@auver
Copy link

auver commented Sep 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants