title: Uncaught TypeError: Cannot read properties of undefined (reading 'isBatchingLegacy')
body: <p>I am trying to test a react typescript project using jest but it's giving a confusing error:</p>
  <p><a href="https://i.stack.imgur.com/gdWQp.png" rel="noreferrer">Error image</a></p>
  <p>Here is my package.json:</p>
  <pre><code>&quot;dependencies&quot;: {
      &quot;@testing-library/jest-dom&quot;: &quot;^5.16.4&quot;,
      &quot;@testing-library/react&quot;: &quot;^12.1.5&quot;,
      &quot;@testing-library/user-event&quot;: &quot;^13.5.0&quot;,
      &quot;@types/jest&quot;: &quot;^27.4.1&quot;,
      &quot;@types/node&quot;: &quot;^16.11.26&quot;,
      &quot;@types/react&quot;: &quot;^17.0.43&quot;,
      &quot;@types/react-dom&quot;: &quot;^17.0.14&quot;,
      &quot;jest&quot;: &quot;^27.5.1&quot;,
      &quot;react&quot;: &quot;^17.0.2&quot;,
      &quot;react-dom&quot;: &quot;^17.0.2&quot;,
      &quot;react-router-dom&quot;: &quot;^6.2.2&quot;,
      &quot;react-scripts&quot;: &quot;5.0.0&quot;,
      &quot;ts-jest&quot;: &quot;^27.1.4&quot;,
      &quot;typescript&quot;: &quot;^4.6.3&quot;,
      &quot;web-vitals&quot;: &quot;^2.1.4&quot;,
  },
  
  &quot;devDependencies&quot;: {
      &quot;@types/react-test-renderer&quot;: &quot;^18.0.0&quot;,
      &quot;react-test-renderer&quot;: &quot;^18.1.0&quot;
  }
  </code></pre>
  <p>I wrote this basic test which gives the error:</p>
  <pre><code>import renderer from 'react-test-renderer'
  import AddShipmentButton from './AddShipmentButton'
  
  it('works', () =&gt; {
      const tree = renderer.create(&lt;AddShipmentButton /&gt;).toJSON()
      expect(tree).toMatchSnapshot()
  })
  </code></pre>
  <p>I had to install the dependencies using --legacy-peer-deps. What could be the issue? Thanks in advance.</p>