Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

305
Visualizações
Getting error on React JS while using fontawesome 5 Error: Could not find icon ObjecticonName: "faHeart"prefix: "fas"

I am trying to add fontawesome icon on my react js project but getting an error.

npm version: 8.1.4
node version: 17.2.0

├─┬ @fortawesome/react-fontawesome@0.1.16
│ └── react@17.0.2 deduped
├─┬ @testing-library/react@11.2.7
│ └── react@17.0.2 deduped
├─┬ react-dom@17.0.2
│ └── react@17.0.2 deduped
├─┬ react-icons@4.3.1
│ └── react@17.0.2 deduped
├─┬ react-scripts@4.0.3
│ └── react@17.0.2 deduped
└── react@17.0.2

I want to add two heart icons on my project. One is solid and one is regular. The code is for the heart icons are:

<i class="far fa-heart"></i>
<i class="fas fa-heart"></i>

On my react.js project, a class component I have declared named Like, and the code is shown below:

import React from 'react';
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
import { faHeart } from '@fortawesome/free-regular-svg-icons';

class Like extends React.Component {
  render() {
    return <FontAwesomeIcon icon={['fas', 'faHeart']}></FontAwesomeIcon>;
  }
}

export default Like;

I get this error: Could not find icon {prefix: 'fas', iconName: 'faHeart'}

If I use return <FontAwesomeIcon icon={faHeart}></FontAwesomeIcon>; then it solved but I need to add the two icon ones prefix is fas and ones is fas.

How can I do that? Please help me. I am new to React.js.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda