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.
For anyone facing this annoying problem using
styled-component
, I solved it by referring to this and this to render your styling on the server side before your page loads. Hope this helps someone end their frustration