medipass / react-payment-inputs

A React Hook & Container to help with payment card input fields.
https://medipass.github.io/react-payment-inputs
342 stars 62 forks source link

SSR shows an warning with useLayoutEffect #14

Closed coderdiaz closed 2 years ago

coderdiaz commented 5 years ago

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

sanchan commented 4 years ago

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