J Akhtar
J Akhtar

Reputation: 667

FontAwesome icon prop error in Nextjs project

I have Nav bar component where I am trying to insert FontAwesome icon but it is saying: Type "icon" is not assignable to type 'IconProp'.

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';

    export Nav = () => {
    
    return (
<ul>
       <li>My Profile <FontAwesome icon="fa-solid fa-right-from-bracket" /></li>
    </ul>
)

}

Upvotes: 0

Views: 1328

Answers (1)

Iman Emadi
Iman Emadi

Reputation: 420

you have to import the Icon Definitions.

import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faLocationDot } from '@fortawesome/free-solid-svg-icons';

// usage -->
<FontAwesomeIcon icon={faLocationDot} />

Upvotes: 2

Related Questions