import React, { useState } from 'react';
function App() {
const [isHovered, setIsHovered] = useState(false);
const handleHover = () => {
setIsHovered(true);
};
const handleLeave = () => {
setIsHovered(false);
};
return (
<div>
{isHovered ? (
<div
onMouseEnter={handleHover}
onMouseLeave={handleLeave}
>
{/* Content of the first div */}
<h2>Hover over me</h2>
</div>
) : (
<div>
{/* Content of the second div */}
<h2>Hovered!</h2>
</div>
)}
</div>
);
}
export default App;
For further actions, you may consider blocking this person and/or reporting abuse
Top comments (2)
Bookmarked. Will utilize it in my project..
Thanks for sharing
My pleasure