diff --git a/errors/react-hydration-error.md b/errors/react-hydration-error.md index 5b0ae7b6a500a..e78e9b7c54976 100644 --- a/errors/react-hydration-error.md +++ b/errors/react-hydration-error.md @@ -37,6 +37,40 @@ function MyComponent() { } ``` +Another example: + +Invalid HTML may cause hydration mismatch such as div inside p. + +```jsx +export const IncorrectComponent = () => { + return ( +

+

+ This is not correct and should never be done because the p tag has been + abused +
+ +

+ ) +} +``` + +How to fix it: + +```jsx +export const CorrectComponent = () => { + return ( +
+
+ This is correct and should work because a div is really good for this + task. +
+ +
+ ) +} +``` + Common causes with css-in-js libraries: - When using Styled Components / Emotion