title: How do you remove query params from the current route?
body: <p>I have a <code>/cart</code> route that accepts a couple of query params called <code>validate</code> and <code>email</code>. They’re only used when a user isn’t logged in and are unnecessary when they are. In the latter case I would like to remove them from the URL.</p>
  
  <p>This is my current <code>onEnter</code> function for the <code>/cart</code> route:</p>
  
  <pre><code>const requireCartLogin = (props, replace) =&gt; {
      const { email, validate } = props.location.query;
  
      // Exit process if the 'validate' query isn’t present.
      if (typeof validate === 'undefined') { return; }
  
      if (!isAuthenticated() || requiresReauthentication()) {
          replace({
              pathname: '/account/signin',
              query: { step: 'signin' },
              state: {
                  email: typeof email !== 'undefined' ? email : null,
                  auth: true,
                  next: '/cart'
              }
          });
      } else if (isAuthenticated()) {
          replace({
              pathname: '/cart',
              query: null
          });
      }
  };
  </code></pre>
  
  <p>It’s that second part of the conditional that should be removing the query params, but it isn’t currently working. What am I missing here?</p>