title: Animate Presence exit not working framer motion
body: <p>Animate presence <strong>exit</strong> prop is not working</p>
  <p>what i am doing wrong?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>&lt;AnimatePresence&gt;
        &lt;motion.div
          initial={{ opacity: 0, x: "-100%" }}
          animate={{ opacity: 1, x: 0 }}
          exit={{ opacity: 0, x: "100%" }}&gt;
          &lt;h1&gt;Head&lt;/h1&gt;
        &lt;/motion.div&gt;
  &lt;/AnimatePresence&gt;</code></pre>
  </div>
  </div>
  </p>
  <p><strong>Fixed!!</strong></p>
  <p>Fixed it by adding these two props to Switch:</p>
  <p>import {useLocation} from &quot;react-router-dom&quot;;</p>
  <p>const location = useLocation();</p>
  <pre><code>&lt;Switch location={location} key={location.pathname}&gt;
  //Routes
  &lt;/Switch&gt;
  </code></pre>