Created
May 25, 2022 18:55
-
-
Save frivas/fbc04fe8378a1fbabcb2e9a0b50a3bd5 to your computer and use it in GitHub Desktop.
Chapter 06 - 6.2.3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function BlinkingBackground() { | |
const [isLeft, setLeft] = useState(true); | |
console.log(isLeft); | |
const onMouseMove = (evt) => { | |
return setLeft(evt.nativeEvent.offsetX < 90); | |
}; | |
const divStyle = { | |
backgroundColor: isLeft ? "blue" : "red", | |
width: "100px", | |
height: "100px" | |
}; | |
return <div style={divStyle} onMouseOver={onMouseMove} />; | |
} | |
export default BlinkingBackground; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment