Custom rendering in React Testing Library Done Right

Browsing multiple projects, I encountered a recurring pattern when trying to write a custom render for components that use Providers (React-Redux’s Provider, React-Intl’s IntlProvider for example).
This pattern usually looks like this:

renderWithRedux example, it’s a bad practice

This function is nice. It creates a utility that lets us call it whenever we want to test a connected component…