Click event inside the Link
#158
Unanswered
SupertigerDev
asked this question in
Q&A
Replies: 1 comment 6 replies
-
Does preventDefault on the event work: const onClose = (event) => {
event.preventDefault();
alert('clicked');
}; |
Beta Was this translation helpful? Give feedback.
6 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
If i have something like this:
How can I prevent the navigation from the
Link
component from happening when i click on theClick me to close
div?https://stackblitz.com/edit/github-imhxsg?file=src%2FApp.tsx%3AL26
Edit: In the stackblitz above, adding
preventDefault
toonClose
Works it seems. But in the example below, It doesnt. Strange.https://stackblitz.com/edit/github-imhxsg?file=src%2FApp.tsx
Edit: oops, i forgot to fork the project, so both links are the same ;( but the issue is still there
Beta Was this translation helpful? Give feedback.
All reactions