I'm pretty new reactJS. I have a component for bootstrap card shown below,
const Card = (props) => {
return (
<div className="col-xl-3 col-lg-4 col-md-6 col-sm-12">
<div className="card">
<a data-src="https://www.youtube.com/embed/A-twOC3W558" data-toggle="modal" data-target="#myModal"><img className="card-img-top" src={props.avatar_url} alt="card" /></a>
<div className="card-body">
<h3 className="card-title">{props.login}</h3>
<p className="card-text">{props.events_url}</p>
</div>
</div>
</div>
)}
It has a image inside anchor tag. My requirement was, when i click on this image it should open the bootstrap modal.
The bootstrap modal component is shown below, its actually in a different file.
class Modal extends Component {
render() {
return (
<div className="container">
<div className="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div className="modal-dialog" role="document">
<div className="modal-content">
<div className="modal-body">
<button type="button" className="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
<div className="embed-responsive embed-responsive-16by9">
<iframe className="embed-responsive-item" src="" id="video" allowscriptaccess="always">></iframe>
</div>
</div>
</div>
</div>
</div>
</div>
)
}
}
How can make the modal to open when I click on the image?