title: react-router-dom - TypeError: Cannot read properties of undefined (reading 'pathname')
body: <p>While using react-router-dom 5.3.0, I am opening a modal but am not changing route, and this error appears.</p>
  <p>I have since downgraded react-router-dom to 5.2.0 and this error does not appear.</p>
  <p>Any help is much appreciated :-)</p>
  <p><a href="https://i.stack.imgur.com/XdnHq.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/XdnHq.png" alt="Error Message" /></a></p>