import React from "react" ; import "./index.less" ; import { useHistory , useLocation , useParams , useRouteMatch , } from "react-router-dom" ; import { Button , Icon } from "zent" ; interface IProps { title ? : string ; } export const UseRouter = ( ) => { const history = useHistory ( ) ; console . log ( useHistory ( ) , "useHistory" ) ; console . log ( useLocation ( ) , "useLocation" ) ; console . log ( useParams ( ) , "useParams" ) ; console . log ( useRouteMatch ( ) , "useRouteMatch" ) ; const handleGo = ( path ) => { history . push ( path ) ; } ; return ( < > < div > < Button type = "primary" onClick = { ( ) => { handleGo ( "/home" ) ; } } > 跳转首页 < Icon type = "right-circle-o" / > < /Button> < /div> < />); } ; export default UseRouter ;