Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <Modal
- isOpen={this.state.modalIsOpen}
- onAfterOpen={this.afterOpenModal}
- onRequestClose={this.closeModal}
- chosenBeer={this.state.chosenBeer}
- >
- <h2> == Dynamically changing title of element == </h2>
- <button onClick={this.closeModal}>X</button>
- <img src="{ == Dynamically changing image == }" />
- </Modal>
- <div id="splashElements">
- {
- this.state.elements &&
- this.state.elements.map((item, index) => {
- return(<SingleElement key={index} name={item.name} href={item.href} image={item.image_url} tagline={item.tagline} onDelete={id => this.onDelete(index)} openModal={elementId => this.openModal(index)}/>)
- })
- }
- </div>
- openModal = (beerId) => {
- this.setState({modalIsOpen: true, chosenBeer: this.state.beers[beerId]});
- }
- afterOpenModal = () =>{
- // references are now sync'd and can be accessed.
- }
- closeModal = () => {
- this.setState({modalIsOpen: false});
- }
Add Comment
Please, Sign In to add comment