Home > front end >  How to make a word clickable in text on React JS
How to make a word clickable in text on React JS

Time:10-07

I am trying to get people to follow my twitter and discord by clicking on the words "Twitter" or "Discord" in the midst of my text. How would I do that below?

<p className="leading-[1.8] md:leading-[1.8] text-base md:text-xl max-w-[700px] my-9 font-secondary">
    Follow
    us on Twitter or join us in Discord to receive all pertinent news as it happens.{' '}
  </p>

Thanks in advance!

CodePudding user response:

React uses JSX (or TSX if you're using TypeScript), so you can use any standard HTML tags, including <a/> to link to things.

Follow us on <a href="https://twitter.com/whatever">Twitter</a>

CodePudding user response:

Just use the a tag like this:

<p>Follow me on <a href="yourUrl">Twitter</a></p>
  • Related