Skip to content

Instantly share code, notes, and snippets.

@paigen11
Last active April 12, 2020 15:50
Show Gist options
  • Save paigen11/29d921de0c01497440703fbf38df291a to your computer and use it in GitHub Desktop.
Save paigen11/29d921de0c01497440703fbf38df291a to your computer and use it in GitHub Desktop.
Sample JavaScript code of React Transition Group's CSSTransition component
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