Estoy usando enrutadores de reacción y para cambiar la URL estoy haciendo history.push (nombre de la ruta), pero está recargando la página completa. No quiero actualizar o volver a cargar la página, probé con replace y replacestate todavía la página se está recargando, ¿alguien podría sugerirme la solución?
history.push( `/dashboard/filter?studyName=${JSON.stringify(study_dashboard_new)?JSON.stringify(study_dashboard_new):JSON.stringify([])}&compoundName=${JSON.stringify(compound_dashboard_new)?JSON.stringify(compound_dashboard_new):JSON.stringify([])}` );Gracias
Debe usar el history del useHistory de react-router-dom .
import { useHistory } from "react-router-dom"; function HomeButton() { const history = useHistory(); function handleClick() { history.push("/home"); } return ( <button type="button" onClick={handleClick}> Go home </button> ); }