Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Runtime Error , Error: Text content does not match server-rendered HTML. #225

Open
talpx0 opened this issue Oct 20, 2023 · 1 comment

Comments

@talpx0
Copy link

talpx0 commented Oct 20, 2023

const { theme } = useTheme();
    const bgImgProps:BgImgStateProps = {
        bgImgDegree: "45deg",
        colorStops: [
            { color: "#2b2e4a", percent: "0%" },
            { color: "#c4caef", percent: "50%" }
        ]
    }
    const darkBgImgProps: BgImgStateProps = {
        bgImgDegree: "90deg",
        colorStops: [
          { color: "#463f3a", percent: "0%" }, 
          { color: "#2b2e4a", percent: "50%" } 
        ]
    };
    const glassEffectProps = {
        bgTransparent: 0.5,
        blur: "5px",
        glassBgColor: "rgb(255, 255, 255)",
    }
    const initialState = theme === "dark" ? darkBgImgProps : bgImgProps;
    const [bgImgState, imgDispatch] = useReducer(bgImgReducer, initialState)
Unhandled Runtime Error
Error: Text content does not match server-rendered HTML.

See more info here: https://nextjs.org/docs/messages/react-hydration-error

I know why this will happen , I just can't find a way to fix it , I can't use classname inject the css directly , cause I have lots of update on the props

@Batouq
Copy link

Batouq commented Oct 25, 2023

if you go to https://github.com/pacocoursey/next-themes#avoid-hydration-mismatch you will find your solution

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants