Reactjs 在Atlassian Jira插件中设置react路由器
我正在使用React JS开发一个用于前端的Jira插件,在设置路由时遇到了问题 设置非常基本:Reactjs 在Atlassian Jira插件中设置react路由器,reactjs,react-router,jira,jira-plugin,Reactjs,React Router,Jira,Jira Plugin,我正在使用React JS开发一个用于前端的Jira插件,在设置路由时遇到了问题 设置非常基本: <BrowserRouter> <Sidebar /> <Switch> <Route path='/'><MainComponent /></Route> <Route path='/other'><Oth
<BrowserRouter>
<Sidebar />
<Switch>
<Route path='/'><MainComponent /></Route>
<Route path='/other'><OtherComponent /></Route>
</Switch>
</BrowserRouter>
我已经尝试将useHistory钩子应用到我的导航链接,就像这样来解决这个问题,但没有效果
let history = useHistory();
function handleClick() {
history.push("/other");
}
<Link to="/other" onClick={handleClick}>OtherComponent</Link>
let history=useHistory();
函数handleClick(){
历史推送(“/其他”);
}
其他组件
导航链接不起作用,甚至不会更改URL。手动将/comp-a添加到当前URL的顶部(很傻,但是…必须尝试一切,你知道)也不起作用。这是一个需要以特定方式处理的Atlassian限制吗
另外,据我所知,Atlassian提供了他们自己的路由解决方案react resource router,但如果可能的话,我宁愿选择react router
let history = useHistory();
function handleClick() {
history.push("/other");
}
<Link to="/other" onClick={handleClick}>OtherComponent</Link>