Skip to main content

Subscription

The object returned from Store#subscribe(). This is an entire object instead of just a cleanup function like Redux. This matches the proposed observable spec.

Definition

interface Subscription {
unsubscribe(): void
}

Methods

unsubscribe

Removes the subscription. Can be called with no context - e.g. in FP paradigms like:

useEffect(() => myStore.subscribe(subscriber).unsubscribe, [myStore])

See Also