I'm currently working on a project to create a React app and I'd like to incorporate an opacity fade-in transition for an image overlay when the user hovers over it. While I understand how to achieve this using the traditional ":hover" method, I'm seeking clarification on how to implement it with React components. The code snippet provided below isn't producing the desired transition effect. Any assistance would be greatly appreciated.
.overlay-image-3 {
background-image: url("../public/images/h5.png");
background-size: cover;
background-position: center;
opacity: 1;
position: absolute;
width: 100%;
height: 100%;
display: none;
z-index: 2;
border-radius: 3px;
transition: opacity 0.1s ease;
}
const [hover, setHover] = useState(false);
<Grid
onMouseEnter={() => setHover(true)}
onMouseLeave={() => setHover(false)}
style={imageOne}>
<div
className='overlay-image-1'></div>
</Grid>