I use Typescript + ReactJS and I try to add a link in font awesome icons. My code is like this:
import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
import { faRandom } from '@fortawesome/free-solid-svg-icons'
const MiddleHeading = () => {
return (
<div id="middle_heading">
<FontAwesomeIcon icon={faRandom} size="2x"/>
</div>
);
};
export default MiddleHeading;
Any idea on how to add a URL to my icon?
thanks for any help
You do not need Link
from react-router-dom
at all as mentioned in the other answer. Just a simple HTML <a>
will work
<div id="middle_heading">
<a href="example.com">
<FontAwesomeIcon icon={faRandom} size="2x"/>
</a>
</div>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With