【发布时间】:2022-07-01 21:08:47
【问题描述】:
const handleStartClick = () => {
const email = localStorage.getItem('email')
if (email !== null && email.length !== 0) {
alert('not empty!')
} else {
<Routes>
<Route path="/EmailInput" element={<EmailInput />}/>
</Routes>
}
}
我想在 else 条件下使用路由器来路由到不同的组件。 按钮点击后调用函数(handleStartClick)。
【问题讨论】:
标签: javascript reactjs