Skip to content

[BUG] useLayoutEffect warning in dev mode #954

Closed
@joulev

Description

@joulev

Describe the bug
When using react-tooltip, there is a useLayoutEffect warning, although the tooltip itself works fine.

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 he (/Users/joulev/dev/www/debug/node_modules/.pnpm/react-
[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-tooltip/dist/react-
tooltip.cjs.min.js:15:3103)
    at exports.Tooltip (/Users/joulev/dev/www/debug/node_modules/.pnpm/react-
[email protected]_biqbaboplfbrettd7655fr4n2y/node_modules/react-tooltip/dist/react-
tooltip.cjs.min.js:15:7943)
    ...

Version of Package
v5.8.1

To Reproduce

Expected behavior
No warning should be shown.

Screenshots
N/A

Additional context
The repro repo uses Next.js 13, but this one is different from #933 as I have disabled SWC minification.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions