我试图在反应路由器版本 5 中执行查询参数
<PrivateRoute
path={["/updateAddress","/updateAddress/:id"]}
element={<UpdateAddress />}
/>
但我收到错误
TypeError: a.replace is not a function
aa
http://localhost:3000/static/js/vendors~main.chunk.js:57160:20
Q
http://localhost:3000/static/js/vendors~main.chunk.js:57133:7
M
http://localhost:3000/static/js/vendors~main.chunk.js:57035:11
function mountMemo(nextCreate, deps) {
var hook = mountWorkInProgressHook();
var nextDeps = deps === undefined ? null : deps;
> var nextValue = nextCreate();
hook.memoizedState = [nextValue, nextDeps];
return nextValue;
}
PS 我什至尝试过
<PrivateRoute
path="/updateAddress/:id?"
element={<UpdateAddress />}
/>
不幸的是它不适用于 /updateAddress
和 updateAddress/1