-
Notifications
You must be signed in to change notification settings - Fork 27.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a click handler with addEventListener to an anchor inside a Link breaks Link #5247
Comments
Can you create a minimal repository for this, I wonder if we should even support this, I'm guessing it's just a React vs DOM api thing instead of a real issue with Next.js, but I can have a look. |
Do you happen to have a CodeSandbox or StackBlitz starter? Those are easier to work with. It's worth making one, and leave the link in the issue template for people to fork. |
They don't support Next.js, you could try repl.it, but you could also push up a repository like everyone else 😄 |
Heeeeeeeey, look! https://repl.it/site/languages/nextjs |
That's just the landing page haha, I knew they support Next.js, hence why I mentioned it. |
Cool. I'll use that to make a repro when I circle back. |
Bug report
Describe the bug
I want to
If some React component is like the following,
then in some other file I want to do
but this breaks the
Link
behavior, and causes the page to do a full refresh instead of changing routes.I do not have access to (it is very complicated to supply)
onClick
handler inside the other component. I need to do it simply, with the imperative DOM API.Expected behavior
How do we add a click handler imperatively without breaking the
Link
?System information
The text was updated successfully, but these errors were encountered: