【发布时间】:2023-03-06 23:45:01
【问题描述】:
我有一个演示 here
这是一个使用打字稿和样式化组件的简单反应应用程序。
我有一个滑块可以改变红色框的高度。
红色框是一个样式组件,我将高度作为道具传递。
这一切都奏效了,但当我将它全部包围在另一个样式组件中以设置页面样式时,这一切都停止了。
控制台有很多警告,例如
The component styled.div with the id of "sc-dlnjwi" has been created dynamically.
You may see this warning because you've called styled inside another component.
To resolve this only create new StyledComponents outside of any render method and function component.
谁能解释这里发生了什么以及为什么滑块在另一个样式组件中时不起作用
【问题讨论】:
标签: reactjs typescript styled-components