TypeError: a.replace is not a function in React Router Dom V5 error

时间:2021-04-28 07:09:51

标签: reactjs react-router

我试图在反应路由器版本 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 />}
          />

不幸的是它不适用于 /updateAddressupdateAddress/1

0 个答案:

没有答案