reactjs - 失败的道具类型:提供给“重定向”的无效道具“到”
问题描述
我的 app.js 看起来像这样:
export default function App() {
return (
<BrowserRouter>
<Switch>
<Route path="/auth" component={AuthenticationLayout} />
<Route path="/dash" component={DashboardLayout} />
<Route exact path="/" render={() => (
<Redirect to={AuthenticationLayout} />
)}/>
</Switch>
</BrowserRouter>
);
}
Can't undersatnd 有什么问题
建议?
解决方案
重定向是导航到一个新位置,to
接受要重定向到的 URL,你可以这样写:
<Route exact path="/" render={() => (
<Redirect to="/auth" />
)}/>
推荐阅读
- python - 如何从 Angular 向 Flask 服务器发出 POST 请求
- javascript - 如何在本机反应中获取所选元素?
- python-3.x - 使用 matplotlib 未显示绘图
- php - 扩展一个始终将“where status = 'cancelled'”附加到选择语句的 Laravel 模型?
- javascript - 编写高性能的 Javascript 代码而不会去优化
- java - 是什么导致我的 java awt 和 swing 浏览器的后退按钮无法正常工作?
- google-colaboratory - 在 google colab 中传递命令行参数
- javascript - 如何将项目的 id 从列表传递给其他函数
- tabulator - 带有分页的制表符动态高度
- css - Tailwind CSS - 固定位置的溢出页脚