【发布时间】:2017-11-25 01:39:02
【问题描述】:
您好,感谢您在这里所做的出色工作。我正在为我的项目使用 react.js 来构建我的组件,我现在感觉有点卡在我的项目中。我正在尝试使用悬停功能设置按钮的样式,但我不知道如何应用它来做出反应。
代码如下:
let button = {
backgroundColor: colorPalette.white,
border: "1px solid rgb(12,106,145)",
color: colorPalette.brandCol1,
textAlign: 'center',
textDecoration: 'none',
fontSize : 'inherit',
fontWeight : 600,
padding : "5px 8px 5px 8px"
}
我想给它添加一个悬停样式,就像我们在 css 中做的那样
button:hover {
style here.......
}
什么是正确的语法?
【问题讨论】:
-
在 JavaScript 中使用 React 和事件处理程序...
-
能否提供实际的 React 代码?