Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Use History React Router v5 app

// This is a React Router v5 app
import { useHistory } from "react-router-dom";

function App() {
  let history = useHistory();
  function handleClick() {
    history.push("/home");
  }
  return (
    <div>
      <button onClick={handleClick}>go home</button>
    </div>
  );
}
Source by reactrouter.com #
 
PREVIOUS NEXT
Tagged: #Use #History #React #Router #app
ADD COMMENT
Topic
Name
5+9 =