title: react-testing-library - Screen vs Render queries
body: <p>There are two ways to use queries using <a href="https://testing-library.com/docs/react-testing-library/intro" rel="noreferrer"><code>react-testing-library</code></a>.</p>
  
  <p>You can either use the queries returned by the <a href="https://testing-library.com/docs/react-testing-library/api#render" rel="noreferrer"><code>render</code></a> method:</p>
  
  <pre><code>import React from 'react'
  import { render } from '@testing-library/react'
  
  ...
  
  const { getByText } = render(&lt;div&gt;Foo&lt;/div&gt;)
  
  expect(getByText('Foo')).toBeInTheDocument()
  </code></pre>
  
  <p>Or you can use the <a href="https://testing-library.com/docs/dom-testing-library/api-queries#screen" rel="noreferrer"><code>screen</code></a> object:</p>
  
  <pre><code>import React from 'react'
  import { render, screen } from '@testing-library/react'
  
  ...
  
  render(&lt;div&gt;Foo&lt;/div&gt;)
  
  expect(screen.getByText('Foo')).toBeInTheDocument()
  </code></pre>
  
  <p>But there is no indication in the documentation about which one is the best option to use and why.</p>
  
  <p>Can someone enlighten me?</p>