NextJS和Uikit框架:Prop className不匹配
我正在使用 uikit Framework 在我的Next.js项目中。
在此html代码中:
<div className="uk-child-width-1-2@m" data-uk-grid>...</div>
它给出此错误:
Warning: Prop `className` did not match.
Server: "uk-child-width-1-2@m uk-grid uk-grid-stack"
Client: "uk-child-width-1-2@m"
实际上,data-uk-grid
添加了2个类(uk-rid
和uk-rid-stack < /code>)通过其JS到该元素。因此,服务器和客户端的类列表(由于服务器端渲染)存在差异,NextJS给出了此错误。
有人可以解决这个问题吗?
I'm using uikit framework in my next.js project.
In this HTML code:
<div className="uk-child-width-1-2@m" data-uk-grid>...</div>
It gives this error:
Warning: Prop `className` did not match.
Server: "uk-child-width-1-2@m uk-grid uk-grid-stack"
Client: "uk-child-width-1-2@m"
In fact, the data-uk-grid
adds 2 classes (uk-grid
and uk-grid-stack
) to the element by its js. So there is a difference in the list of classes in Server and Client (due to server side rendering), and Nextjs gives this error.
Does anyone have a solution to this issue?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论