Skip to main content

<RemoveSubscribe />

A React Component that prevents its children from using a parent <Subscribe>.

This is useful when you need a Root component to have a <Subscribe>, but you don't want some of its children to leak subscriptions on it.


const user$ = state(/* ... */)

function App() {
const user = useStateObservable(user$)

return (
<Header>Application Example</Header>
{/* none of the routes will be able to use the top-level <Subscribe> */}
<AppRoutes />

<App />

This component only prevents its children from leaking subscriptions to a parent <Subscribe />. If that Subscribe had a fallback, it will not prevent the from using the Suspense boundary.

See also