We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
The title says it all
import { BehaviorSubject } from "rxjs"; import { useObservableState } from "observable-hooks"; const tempBehavior$ = new BehaviorSubject({ hello: "message" }); export default function App() { const tempBehavior = useObservableState(tempBehavior$); return <div>{tempBehavior.hello}</div>; }
Test Link is here: https://codesandbox.io/s/aged-butterfly-rqzwb?file=/src/App.tsx
the typing about this form should be like that
export function useObservableState<TState>( input$: BehaviorSubject<TState> ): TState
rxjs version: 6, 7 (both not working)
The text was updated successfully, but these errors were encountered:
If you want to have the initial value synchronously extracted from the BehaviorSubject then you should consider using useObservableEagerState https://observable-hooks.js.org/api/#useobservableeagerstate .
BehaviorSubject
useObservableEagerState
Alternatively, you could provide the useObservableState an "initial value" as its second argument. Like:
useObservableState
const tempBehavior = useObservableState(tempBehavior$, {});
Sorry, something went wrong.
This is actually a bug. useObservableState should pick up the BehaviorSubject.value automatically. I am fixing the tests to reflect that.
BehaviorSubject.value
7603979
No branches or pull requests
The title says it all
Test Link is here: https://codesandbox.io/s/aged-butterfly-rqzwb?file=/src/App.tsx
the typing about this form should be like that
rxjs version: 6, 7 (both not working)
The text was updated successfully, but these errors were encountered: