【发布时间】:2022-11-28 08:17:21
【问题描述】:
**const redirect = location.search? location.search.split('=') : "/account" ;
useEffect(() => {
if (error) {
alert.error(error);
dispatch(clearErrors());
}
if (isAuthenticated) {
navigate(redirect);
}
}, [dispatch, error, alert, history, isAuthenticated, redirect]);**
这不起作用任何人请告诉我我在这个地方更换了什么,以便我的这个功能工作。我非常感谢你。
【问题讨论】:
-
你是这样使用
const location = useLocation()的吗? -
除了“它不起作用”之外,您能否更具体地说明问题是什么?请更新您的问题以包含 minimal, complete, and reproducible code example。
标签: reactjs react-router