title: How to remove query param with react hooks?
body: <p>I know we can replace query params in component based classes doing something along the lines of:</p>
  
  <pre><code>  componentDidMount() {       
      const { location, replace } = this.props;   
  
      const queryParams = new URLSearchParams(location.search);   
      if (queryParams.has('error')) { 
        this.setError(    
          'There was a problem.'  
        );    
        queryParams.delete('error');  
        replace({ 
          search: queryParams.toString(), 
        });   
      }   
    }
  </code></pre>
  
  <p>Is there a way to do it with react hooks in a functional component?</p>