Skip to content

Nextjs SSR prints warning on useLayoutEffect #4

Description

@ichn-hu

If we use the react component in SSR, the following warning will be generated

Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
    at ReactCusdis (/home/ichn/Documents/notion-blog-v2/node_modules/react-cusdis/dist/ReactCusdis.js:7:26)
    at div
    at RenderPost (/home/ichn/Documents/notion-blog-v2/.next/server/pages/blog/[slug].js:2970:3)
    at MyApp (/home/ichn/Documents/notion-blog-v2/.next/server/pages/_app.js:37:3)
    at AppContainer (/home/ichn/Documents/notion-blog-v2/node_modules/next/dist/server/render.js:293:29)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions