エラー辞典
エラー文をそのまま貼って探せるようにしています。 直し方だけでなく、なぜ起きたのかまで書いてあります。
- Event handlers cannot be passed の直し方Error: Event handlers cannot be passed to Client Component props. {items: [...], onAdd: function f} ^^^^^^^^^^ If you need interactivity, consider converting part of this to a Client Component.
- Hydration failed の直し方Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used: - A server/client branch `if (typeof window !== 'undefined')`. - Variable input such as `Date.now()` or `Math.random()` which changes each time it's called. - Date formatting in a user's locale which doesn't match the server. - External changing data without sending a snapshot of it along with the HTML. - Invalid HTML tag nesting.
- useState を import できないエラーError: You're importing a module that depends on `useState` into a React Server Component module. This API is only available in Client Components. To fix, mark the file (or its parent) with the `"use client"` directive.
- Only plain objects の直し方Error: Only plain objects, and a few built-ins, can be passed to Client Components from Server Components. Classes or null prototypes are not supported.
- window is not defined の直し方ReferenceError: window is not defined Error occurred prerendering page "/". Read more: https://nextjs.org/docs/messages/prerender-error Export encountered an error on /page: /, exiting the build.