我有一个在点击按钮时运行的函数。我想将用户定向到外部站点。我似乎无法使用 history.push 来完成它,因为它将站点附加到 localholst 即 http://localhost:8080/EXTERNALSITE
我正在使用 RR v5
下面的代码有效,但我如何使用 React 路由器?
const handleButtonClick = () => {
if (foo) {
window.location.replace(EXTERNALSITE); // how to use RR here?
} else if (userToken) {
history.push('/home');
} else {
logout();
}
};