“usehistory () gancho” Respostas de código

usehistory

import { useNavigate } from 'react-router-dom';
const navigate = useNavigate();
navigate('/home');
Motionless Mole

Exemplo do uso da história

import { useHistory } from 'react-router-dom';

function Home() {
  const history = useHistory();
  return <button onClick={() => history.push('/profile')}>Profile</button>;
}
Repulsive Rook

equivalente ao usehistory em reação

import { useHistory } from "react-router-dom"; // DEPRECATED
// It is now
import { useNavigate } from "react-router-dom"; // As at March 3, 2022
Code Rabbi

usehistory () gancho

// useHistory() has been changed in v6, so instead use useNavigate()

check out the source link
DareDevil992

Respostas semelhantes a “usehistory () gancho”

Perguntas semelhantes a “usehistory () gancho”

Procure respostas de código populares por idioma

Procurar outros idiomas de código