hero-slider icon indicating copy to clipboard operation
hero-slider copied to clipboard

useLayoutEffect warning on nextjs project

Open aimarjs opened this issue 3 years ago • 0 comments

Hey!

Great job with the slider - very much like it!. One issue is still bugging me though. The fact that useLayoutEffect is used in hero-slider/src/components/Slider/index.tsx file causes a lot of console log warnings.

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.

There's a workaround for this, maybe you could implement this in? Thanks!

https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a

aimarjs avatar Jul 08 '21 10:07 aimarjs