Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

hover react component

const [hover, setHover] = useState(false)

	const hoverStyle = {
    	//Styles
    }
    
    const normalStyle = {
    	//Styles
    }

    const onMouseEnter = () => {
        setHover(true)
    }
    
    const onMouseLeave = () => {
        setHover(false)
    }
    
return (
	<Component style={hover ? hoverStyle : normalStyle} onMouseEnter={onMouseEnter} onMouseLeave={onMouseLeave}> </Component>  
)
 
PREVIOUS NEXT
Tagged: #hover #react #component
ADD COMMENT
Topic
Name
4+1 =