I have a Post
ponent which basically render's a card. If the post is clicked, then the URL should route to '/expand/'
.
Now I have another ponent called DeleteTemplate
which renders a button and clicking it render's a Modal.
Now, I have used this DeleteTemplate
in my Post
ponent.
Now, clicking the DeleteTemplate
button is rendering the Modal. In the Modal if i select the Cancel
option, the URL is getting routed to '/expand/'
which shouldn't be happening.
I have a Post
ponent which basically render's a card. If the post is clicked, then the URL should route to '/expand/'
.
Now I have another ponent called DeleteTemplate
which renders a button and clicking it render's a Modal.
Now, I have used this DeleteTemplate
in my Post
ponent.
Now, clicking the DeleteTemplate
button is rendering the Modal. In the Modal if i select the Cancel
option, the URL is getting routed to '/expand/'
which shouldn't be happening.
1 Answer
Reset to default 4The click events of the buttons in your modal are bubbling up to the card. You need to add event.stopPropagation()
to the onClick
handlers of those buttons inside the modal.
So in your DeleteTemplate
render function:
<Button color="secondary" onClick={this.cancel}>
CANCEL
</Button>
with the cancel handler looking like this:
cancel(event) {
event.stopPropagation();
this.toggleModal();
}
Working example:
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744323173a4568520.html
评论列表(0条)