Testing · Middle · Question 21 of 75

How do you render a component that needs providers (router, store, query client)?

function renderWithProviders(ui: ReactElement) {
  return render(ui, { wrapper: AppProviders });
}

Explanation

Testing Library docs recommend re-exporting a custom render from a test utils module.

Further reading

Problem with a question

Testing · Middle · question 21

Test yourself

Take the Testing · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz