例如,我是Next.js]的新手,我想知道如何从起始页(/)重定向到/ hello-nextjs。用户加载页面后,确定路径是否=== /重定向到/ hello-nextjs
在react-router
中,我们做类似的事情:<Switch>
<Route path="/hello-nextjs" exact component={HelloNextjs} />
<Redirect to="/hello-nextjs" /> // or <Route path="/" exact render={() => <Redirect to="/hello-nextjs" />} />
</Switch>
例如,我是Next.js的新手,我想知道如何从起始页(/)重定向到/ hello-nextjs。用户加载页面后,确定路径是否=== /重定向到/ hello-nextjs在...
在next.js
中,您可以使用Router
重定向:
有三种方法。