Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

243
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda