mitosis icon indicating copy to clipboard operation
mitosis copied to clipboard

setContext to pass a factory function

Open PatrickJS opened this issue 3 years ago • 2 comments

it would be great if we could pass a factory function to setContext

setContext(() => createInjector());

setContext(createInjector);

setContext(() => {
  return {
    get: (token) => inject(token);
  };
});

PatrickJS avatar May 21 '22 20:05 PatrickJS

@steve8708 what do you think?

PatrickJS avatar May 23 '22 13:05 PatrickJS

Oh interesting, yeah if this can map cleanly to the different framework outputs then totally works for me 👍🏼

steve8708 avatar May 23 '22 14:05 steve8708