DI containers are dead, long live context containers!
dev.to·1d·
Discuss: DEV
Flag this post

This story is for you if:

  • You’re still sad React Context cannot be used in Server Components.
  • You like the ideas of SOLID architecture and decoupling in your apps but have found current DI frameworks in TypeScript unsatisfying or too complex.
  • You’ve ever wanted to see a naked, frameworkless DI container in its simplest form (NSFW warning :P).
  • You love TypeScript and enjoy pushing its inference capabilities to their limits.

This is the story of how, while refactoring my React app from Client to Server Components, I was forced to spend a year of my free time to:

  1. rediscover DI containers,
  2. obsolete traditional DI frameworks,
  3. discover Context Containers, and
  4. finally, build my own fully type-inferred context container framework, [typectx](https://typectx.g…

Similar Posts

Loading similar posts...