[英]`react-hover` npm package not in production build but working fine in development
I want to make use of the npm package react-hover
(here's the github link ) in my project and when I develop locally in dev build it works just fine. 我想在我的项目中使用npm包
react-hover
(这是github链接 ),当我在dev build中进行本地开发时,它可以正常工作。 When I run the npm run build
command and serve the production version the components I want to show in the <ReactHover>
object don't render on the page. 当我运行
npm run build
命令并提供生产版本时,要显示在<ReactHover>
对象中的组件不在页面上呈现。
I started the project using create-react-app
I serve the production version locally using the npm package serve
. 我使用
create-react-app
启动了项目,并使用npm包serve
在本地提供了生产版本。
I will share all the files of my project since it's nothing spectacular, here are all files on a public repo . 我将共享项目的所有文件,因为这没什么大不了的,这里是公共仓库中的所有文件 。
I haven't really been able to find this issue anywhere else so any insight would be appreciated. 我真的无法在其他任何地方找到此问题,因此我们将不胜感激。
You can simply use CSS to do that. 您可以简单地使用CSS来做到这一点。 Define two divs, one with id="hover-selector-parent" and another with id="hover-selector-child".
定义两个div,其中一个id为“ =“ hover-selector-parent”,另一个为id =“ hover-selector-child”。
Then configure your CSS file to handle the event - 然后配置您的CSS文件以处理事件-
#hover-selector-parent:hover~#hover-selector-child{
display:block;
}
#hover-selector-child{
display: none;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.