Skip to content

Replace <a> with <a> breaks the link #1369

Closed Answered by ChristianMurphy
hogoww asked this question in Q&A
Discussion options

You must be logged in to vote

Still, in the link, the anchor does not receive any event, so you cannot click on it.

There's a lot going wrong here, and there is no framework bug, but there is a good learning opportunity.


The main issue you are running into is order of operations (mousedown before click) and stable identifiers.

Your event handler updates state, which will re-render the component

  const [contextMenu, setContextMenu] = useState({});

  const func = () => {
    setContextMenu({});
  };

In the second example you define the a function has an anonymous inline function

   <Markdown
        components={{
          a: (props) => { // <= this is anonymous inline
            return <a href={props.href}>{props.c…

Replies: 3 comments 19 replies

Comment options

You must be logged in to vote
12 replies
@ChristianMurphy
Comment options

@hogoww
Comment options

@hogoww
Comment options

@ChristianMurphy
Comment options

@hogoww
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@hogoww
Comment options

@ChristianMurphy
Comment options

@hogoww
Comment options

@ChristianMurphy
Comment options

Answer selected by hogoww
@ChristianMurphy
Comment options

@hogoww
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
👀 no/external This makes more sense somewhere else
2 participants