Choosing Services in Remix: `provideService` vs `provideLayer` vs `Context`
how to choose which serices to pass with
in my Remix app I have the following part of the code describing creating a
my question is this:
the only "static" (created outside of the function) services are provided through
the rest must be provided using the loader args, how should I go about choosing what constructs to use?
At first I used 2
As you can see now I'm constructing layers on every request but I think there might be some perf penalty...
provideService vs provideLayer vs Context?in my Remix app I have the following part of the code describing creating a
loader function, loosely based on the example from the repo:my question is this:
the only "static" (created outside of the function) services are provided through
AppLive,the rest must be provided using the loader args, how should I go about choosing what constructs to use?
At first I used 2
provideService's but in the jsdoc I found that you should use Context if there is more than one service, but I don't even know how to construct a context from effectful services (there is no Context.effect like in the layer case, or no Effect.provideContextEffect like in the service case).As you can see now I'm constructing layers on every request but I think there might be some perf penalty...
