I come from the angular world where we heavily use services and dependency injection. This makes the code easy to test by mocking dependencies. But when it comes to react, I cannot find a clean way to achieve the same. Is there a proper way to inject dependencies in your components ?
Hi Dan !
I come from the angular world where we heavily use services and dependency injection. This makes the code easy to test by mocking dependencies. But when it comes to react, I cannot find a clean way to achieve the same. Is there a proper way to inject dependencies in your components ?
Thanks :)
I tend to either use context for this, or something like
jest.mock()
(that is, if you use Jest).