我使用此代码将按钮从顶部留出边距:
const makeTopMargin = (elem) => {
return styled(elem)`
&& {
margin-top: 1em !important;
}
`;
}
const MarginButton = makeTopMargin(Button);
每当我使用MarginButton
节点,我收到此错误:Warning: Prop
班级名称did not match. Server: "ui icon left labeled button sc-bwzfXH MjXOI" Client: "ui icon left labeled button sc-bdVaJa fKCkqX"
你可以看到这个生成的here https://codesandbox.io/s/xvmq9jjzzq.
我应该怎么办?
或者您可以将其添加到您的next.config.js
。这也使得它如此next-swc (快速网络编译器 https://github.com/swc-project/swc)致力于减少构建时间。看更多这里 https://github.com/vercel/next.js/discussions/30174.
// next.config.js
module.exports = {
compiler: {
// Enables the styled-components SWC transform
styledComponents: true
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)