Skip to content

Instantly share code, notes, and snippets.

@dsternlicht
Last active November 27, 2018 15:00
Show Gist options
  • Select an option

  • Save dsternlicht/2a2ad114fe57fdc9cff44feca1c0e59d to your computer and use it in GitHub Desktop.

Select an option

Save dsternlicht/2a2ad114fe57fdc9cff44feca1c0e59d to your computer and use it in GitHub Desktop.
Using the React Modal component
import React, { Component } from 'react';
import Modal from './modal/modal';
import './app.css';
class App extends Component {
state = {
showModal: false
}
toggleModal = () => {
this.setState({
showModal: !this.state.showModal
});
}
render() {
return (
<div className="app">
<button className="modal_opener" onClick={this.toggleModal}>
Click Me! I Do Not Bite... <span role="img" aria-label="emoji">😛</span>
</button>
<Modal
show={this.state.showModal}
closeCallback={this.toggleModal}
customClass="custom_modal_class"
>
<React.Fragment>
<h2>Told Ya!</h2>
<iframe title="giphy" src="https://giphy.com/embed/l52CGyJ4LZPa0" width="480" height="273" frameBorder="0" className="giphy-embed" allowFullScreen></iframe><p><a href="https://giphy.com/gifs/sandler-sentences-sounding-l52CGyJ4LZPa0">via GIPHY</a></p>
</React.Fragment>
</Modal>
</div>
);
}
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment