Effect CommunityEC
Effect Community6mo ago
2 replies
Tobias

Integrating multiple React Contexts with a shared runtime in Effect Typescript library

At the root of my application, I create a React Context with a ManagedRuntime and all global layers I use, such as an NetworkMonitor etc. (RuntimeContext)

At a later level, in a route layout of some kind, I want to mount a new React Context for a few other services that should only be initialized later in the application. Those services e.g. start a websocket for syncing data, etc., so ideally they should get access to some services in the RuntimeContext.

Can I make them use the same "runtime" somehow, while keeping the boundaries of the context (services might get mounted/unmounted without the RuntimeContext runtime)?
Was this page helpful?