并在ProtectedRoute中获取组件,如下所示:
我认为所有你需要修正的是为未认证的用户重定向到"/login"。而不是一个PUSH导航动作,它应该是一个REPLACE导航动作。这将有助于维护历史堆栈。
我认为所有你需要修正的是为未认证的用户重定向到"/login"。而不是一个PUSH导航动作,它应该是一个...
The switch fromelementTypetoelementis more accurate since the component directly renders the children without any instantiation. This matches React Router v6's expectations better. Let's make sure we ain't breaking nobody's code: ✅ Verification successful Yo, this PropType change is totally legit!