怎么还能驾轻就熟?
import ButtonLogReg from "../components/ButtonLogReg"
import { Link } from 'react-router-dom'
import { useContext } from 'react'
import Context from '../components/Context'
import { useNavigate } from 'react-router-dom'
function Launcher() {
log.info('Home -> render')
const { showAlert } = useContext(Context)
const handler = event => {
event.preventDefault()
try(
asyncFunction()
)catch(error)
}
return <main>
<nav>
<h2 >Go?</h2>
<Link to="/Mypath>"<ButtonLogReg onClick={handler}>READY</ButtonLogReg></Link>
<Link to="/"><h2>Back</h2></Link>
</nav>
</main>
}
export default Launcher
大家好,我试着在/Mypath导航,但是我不能用它做这个,我怎么能做这个呢?
1条答案
按热度按时间ia2d9nvy1#
希望您已经在
App.js
中设置了路由,那么这可能会对您有所帮助: