Last active
April 12, 2020 15:50
-
-
Save paigen11/29d921de0c01497440703fbf38df291a to your computer and use it in GitHub Desktop.
Sample JavaScript code of React Transition Group's CSSTransition component
This file contains 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
const ExampleApp = () => { | |
const [isVisible, setIsVisible] = useState(false); | |
return ( | |
<div> | |
<CSSTransition in={isVisible} timeout={300} classNames="sample"> | |
<div> | |
Now you see me, next click, you don't | |
</div> | |
</CSSTransition> | |
<button type="button" onClick={() => setIsVisible(!isVisible)}> | |
Click to Show / Hide | |
</button> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment