Bug: Hydration error due to <button>
React version:
is there any way to fix this issue
Unhandled Runtime Error Error: Hydration failed because the initial UI does not match what was rendered on the server. See more info here: https://nextjs.org/docs/messages/react-hydration-error
In HTML,
<button>
^^^^^^^^
<_c>
<button>
^^^^^^^^
Link to code example:
https://github.com/JAGADEESHWARAN20/Shopwithdashboard/blob/main/app/(dashboard)/%5BstoreId%5D/(routes)/settings/components/SettingsForm.tsx
i tried So many time to find this issue , but I don't get it ....
screenshot:
how to remove this also
Hey @JAGADEESHWARAN20 👋
I'm not an expert on Next.js, but it looks like this error is caused by nesting two interactive <button>s. That is, you have a button within another button.
Hope this helps!
@JAGADEESHWARAN20 How did you run this project? using yarn test?
Using npm run dev
The error is present because you have nested two buttons because the generated html code will render two buttons side by side whereas during hydration the buttons are nested.
Yeah nesting buttons is invalid HTML.