Reactで意味不明なエラー Uncaught TypeError: can't access property "useContext"
エラーの内容は以下のとおりです。
useContextが読めないと言われています。
Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:1. You might have mismatching versions of React and the renderer (such as React DOM)2. You might be breaking the Rules of Hooks3. You might have more than one copy of React in the same appSee https://react.dev/link/invalid-hook-call for tips about how to debug and fix this problem. Component Stack: Matches Matches.tsx:42 RouterContextProvider RouterProvider.tsx:13 RouterProvider RouterProvider.tsx:48 App unknown:0<anonymous code>:1:145535Uncaught TypeError: can't access property "useContext", dispatcher is null useContext React useRouter useRouter.tsx:9 Matches Matches.tsx:42 React 10 performWorkUntilDeadline scheduler.development.js:44 js scheduler.development.js:219 js scheduler.development.js:364 __require chunk-3O7X656O.js:11 js index.js:6 __require chunk-3O7X656O.js:11 React 2 __require chunk-3O7X656O.js:11 js React __require chunk-3O7X656O.js:11 <anonymous> react-dom_client.js:18146react.development.js:1464:6An error occurred in the <Matches> component.
原因は、プロジェクトディレクトリの「一階層上」に node_modules
ディレクトリがあることでした。
参考:

これ、SOの回答がなかったら自分では絶対気付けなかったですね、恐ろしい…。