Use the React context API instead of mocking in unit tests
3 min readFeb 22, 2021
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…