Ant design style flash when page refresh and low performance
Pfurr opened this issue · comments
hi @luffyZh, sorry for this open issue, anyway it is not completely related to your repo! (:
i'm working with next js and with and-design i have several issues:
- the ant-design ui flashing when page refresh, i use css modules
- poor performance
you can help me to fix? I add my code: https://codesandbox.io/s/priceless-heyrovsky-0pu29?file=/pages/index.js
@pherm
Thank you very much for your attention. It doesn't matter to issue in this repo. But as for your question, I think the Suggestions are as follows:
-
First of all, the reason for this problem is CSS Modules. Dom Tree parsed in the development environment does not have CSS styles.(Or u can insert css in the serverside)
-
Second, this problem does not occur in production environments, which means that only the development environment flashes, I think you can ignore.
-
In the end, in fact I suggest you use
styled-jsx
, after allnext.js && styled-jsx
is a team so have better compatibility
If there are any other questions, u can continue the conversation, I will close the issue ~
@pherm
Grazie per la vostra attenzione. Non importa in questo repository. Ma per quanto riguarda la tua domanda, penso che i suggerimenti siano i seguenti:
- Prima di tutto, la ragione di questo problema sono i moduli CSS. Dom Tree analizzato nell'ambiente di sviluppo non ha stili CSS (oppure puoi inserire CSS nel lato server)
- In secondo luogo, questo problema non si verifica negli ambienti di produzione, il che significa che solo l'ambiente di sviluppo lampeggia, penso che tu possa ignorare.
- Alla fine, infatti, ti suggerisco di usare
styled-jsx
, dopo tuttonext.js && styled-jsx
è una squadra, quindi avere una migliore compatibilitàSe ci sono altre domande, puoi continuare la conversazione, chiuderò il problema ~
thank you for your reply! :)