Skip to content
Advertisement

Easier way to to disable link in React?

I want to disable Link in some condition:

JavaScript

<Link> must specify to, so I can not disable <Link> and I have to use <a>

Advertisement

Answer

You could just set set the link’s onClick property:

JavaScript

Then disable the hover effect via css using the cursor property.

JavaScript

I think that should do the trick?

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement