I am working with next.js and everything seems to be fine when I am using app with npm run dev.
But when I am exporting my next.js app to a static files with command npm run build and trying to open my project for part of the second the screen is unstyled, this cause verry bad user experience.
I know this is called FOUC but how to avoid it on next.js static export?
P.S I am using styled-components library, not sure if that affecting the final result.
If you are using styled-components, I would look into modifying your _document.js file per these instructions: https://styled-components.com/docs/advanced#server-side-rendering
That's how I managed to get out FOUC after trying a bunch of random stuff like:
<script>0</script> tagIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With