The latest recommended option by the react-testing-library author Kent C. Dodds himself is to use screen.
The benefit of using
screenis you no longer need to keep therendercall destructure up-to-date as you add/remove the queries you need. You only need to typescreen.and let your editor’s magic autocomplete take care of the rest.The only exception to this is if you’re setting the
containerorbaseElementwhich you probably should avoid doing (I honestly can’t think of a legitimate use case for those options anymore and they only exist for historical reasons at this point).
Source: https://kentcdodds.com/blog/common-mistakes-with-react-testing-library#not-using-screen