📜  useHistory 钩子 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:43.589000             🧑  作者: Mango

代码示例5
// useHistory() does not work inside an arrow function 
// notice @ line 9 that the history.push() is inside a usual function. not an arrow function

let myComponent = () => {
    
const history = useHistory();
  function routeChange(){
   history.push("/author");
  }
  
  return(<>
  
  )
    
}