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

Warning: useLayoutEffect does nothing on the server #108

Open
3 tasks done
preist opened this issue May 26, 2023 · 0 comments
Open
3 tasks done

Warning: useLayoutEffect does nothing on the server #108

preist opened this issue May 26, 2023 · 0 comments

Comments

@preist
Copy link

preist commented May 26, 2023

Describe the bug

Getting a warning in my project:

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://fb.me/react-uselayouteffect-ssr for common fixes.

Links to this:
https://gist.github.com/gaearon/e7d97cdf38a2907924ea12e4ebdf3c85

Unsure if this is a problem or not.

Reproduction

Create a react app and add a simple carousel.

System Info

System:
    OS: macOS 13.4
    CPU: (10) arm64 Apple M1 Pro
    Memory: 52.91 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 16.19.0 - ~/.nvm/versions/node/v16.19.0/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.3 - ~/.nvm/versions/node/v16.19.0/bin/npm
  Browsers:
    Edge: 112.0.1722.68
    Firefox Developer Edition: 113.0
    Safari: 16.5
  npmPackages:
    @trendyol-js/react-carousel: ^3.0.2 => 3.0.2

Used Package Manager

npm

Logs

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://fb.me/react-uselayouteffect-ssr for common fixes.

Validations

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

1 participant