Use the React context API instead of mocking in unit tests

Does this meme show my age?

In today’s episode of Enterprise Application Nightmares, I’ll tell you how mocking state broke our application and how the React context API could have saved us.

The Context API ⛅

The React context API does not get enough credit. When asked, “When would you use the context API?” the answer is frequently, “Whenever you don’t…