medipass/react-payment-inputs

SSR shows an warning with useLayoutEffect

Closed this issue · 1 comments

I'm using this package with Next.js and works awesome but this shows an warning in devmode because useLayoutEffect is used only for client-side applications for SSR application is better use useEffect according to documentation.

Any suggestion for solve this warning?

image

This may not be related to react-payment-inputs, but to React itself, actually they explain this in their documentation:

If you use server rendering, keep in mind that neither useLayoutEffect nor useEffect can run until the JavaScript is downloaded. This is why React warns when a server-rendered component contains useLayoutEffect.

https://reactjs.org/docs/hooks-reference.html#uselayouteffect