JSX inline style attributes does not allow :hover
. You need to put that in your stylesheet instead.
You can't and even shouldn't put pseudo-classes inline. Put css in class and then apply it by className
like in example below:
JSX:
<NavLink to="/example" className="nav_link">Example</NavLink>
CSS
.nav {
//other styles
//...
a.nav_link:hover {
cursor: pointer;
color: red;
}
}
I prefer the CSS-in-JS method to set the class like so:
nav_link: {
textDecoration: 'none',
'&:hover': {
textDecoration: 'none'
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.