To fix this error I was getting, this is how my code looked in one of my React Components for a Bootstrap Modal:
To fix this, you will need to add the arrow function so you will not get this error anymore:
Do you see the diferrence?
Here is more help:
renderWithHooks@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:11770:23 mountIndeterminateComponent@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:14492:21 beginWork@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:15447:22 beginWork$1@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:19248:22 performUnitOfWork@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:18693:20 workLoopSync@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:18632:30 renderRootSync@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:18611:15 recoverFromConcurrentError@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:18233:42 performConcurrentWorkOnRoot@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:18181:30 workLoop@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:197:50 flushWork@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:176:22 performWorkUntilDeadline@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:384:29 EventHandlerNonNull*node_modules/scheduler/cjs/scheduler.development.js/<@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:405:11 node_modules/scheduler/cjs/scheduler.development.js@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:453:9 __require2@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-NKHIPFFU.js?v=e8169f58:15:50 node_modules/scheduler/index.js@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:465:24 __require2@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-NKHIPFFU.js?v=e8169f58:15:50 node_modules/react-dom/cjs/react-dom.development.js/<@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:481:25 node_modules/react-dom/cjs/react-dom.development.js@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:21031:9 __require2@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-NKHIPFFU.js?v=e8169f58:15:50 node_modules/react-dom/index.js@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-6IIS3HCN.js?v=e8169f58:21044:24 __require2@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-NKHIPFFU.js?v=e8169f58:15:50 node_modules/react-dom/client.js@https://127.0.0.1:5173/node_modules/.vite/deps/react-dom_client.js?v=e8169f58:12:13 __require2@https://127.0.0.1:5173/node_modules/.vite/deps/chunk-NKHIPFFU.js?v=e8169f58:15:50 @https://127.0.0.1:5173/node_modules/.vite/deps/react-dom_client.js?v=e8169f58:38:16
💿 Hey developer 👋
You can provide a way better UX than this when your app throws errors by providing your own errorElement
props on <Route>