[英]With React styled-components, how to add a Modal?
I'm learning how to add styled-components to my React app. 我正在学习如何在我的React应用程序中添加样式化组件。 I'm at the point now where I want to add a Modal Dialog to my app and unsure how to approach this problem with styled components.
现在,我想在我的应用程序中添加一个“模态对话框”,不确定如何使用样式化组件解决此问题。
For those that use styled-components, how did you add a Modal to your app? 对于那些使用样式组件的用户,您如何将Modal添加到您的应用程序中? Do you need to use a styled-component library for this, a react modal library or a jQuery solution?
您是否需要为此使用样式化组件库,react模态库或jQuery解决方案? What's the right way to add a Modal to a React styled-component app?
将模块添加到React样式组件应用程序的正确方法是什么?
Thank you 谢谢
If you have a library that provides a Modal
component, you can wrap it using styledComponents: 如果您有提供
Modal
组件的库,则可以使用styledComponents对其进行包装:
const **WrapperModal** = styled(**Modal**)`
/* yourStyleHere; */
`;
Then call WrapperModal to used instead of your Modal component. 然后,将WrapperModal调用为used而不是您的Modal组件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.