Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

241
Views
Error when deleting a param using react useSearchParams

I'm using a Home Button to delete any parameters in the URL. I keep getting the following error. TypeError: searchParams.delete is not a function

The code for my home button (HomeButton.jsx) is below.

import "../App.css";
import "bootswatch/dist/lumen/bootstrap.min.css";
import { useHistory } from "react-router";
import useSearchParams from "use-search-params";

export default function HomeButton(props) {
  let history = useHistory();
  let [setSearchParams, searchParams] = useSearchParams();

  //when home button is pressed, set state to default, and puch to home page
  function refreshToLandingPage() {
    searchParams.delete();
    props.setState(props.initialState);
    history.push("/");
  }

  return (
    <div id="HomeButton">
      <button
        type="button"
        class="primary-btn"
        style={{ justify: "left" }}
        onClick={() => refreshToLandingPage()}
      >
        Main Menu
      </button>
    </div>
  );
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!