Skip to content
Discussion options

You must be logged in to vote

See https://observable-hooks.js.org/guide/gotchas.html#epic-closure .

You need to place the pipe operation inside the callback function to ensure that a new Observable is not created repeatedly on every render. This is a somewhat counterintuitive design in React.

const delay$ = useObservable(() => storeAction$.pipe(delay(3000));
useSubscription(delay$, () => console.log(`${new Date().toISOString()} delayed`));

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by rt4x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants