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

277
Visualizações
TypeError: bcLi.push(...) is not a function

Hi everyone I'm pretty new to programming and don't really know how to fix errors. I got the code from my university and copied it 1:1. However I always get the error in the title. I think The teacher changed something and didn't change it in the documents she gave us. I googled the error and it seems to be pretty common but the structure is always different compared to my code. As I said I'm new to this and would also appreciate tips on how to fix things on my own in the future.

This is the code. Please let me know if you need more info or other code from another sheet.

import'./BreadCrumb.css';
import {crumbs} from'./data';

function BreadCrumb() {
//const crumbs=["Home","Service","Suche"];
let bcLi=[];
for (let i=0; i<crumbs.length-1;i++) 
{
  bcLi.push(<li className="breadcrumb-item" key={1}>{crumbs[i]}</li>);
}
bcLi.push()(<li className="breadrumb-item active" key={crumbs.length-1} 
aria-current="page">{crumbs[crumbs.length-1]}</li>);

return (
  <div className="bcd">
    <nav aria-aria-label="breadcrumb">
      <ol className="breadcrumb">
        {bcLi}
      </ol>
    </nav>
  </div>
);
}

export default BreadCrumb;
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

bcLi.push()(... needs to be bcLi.push(<li className="breadrumb-item active" key={crumbs.length-1} aria-current="page">{crumbs[crumbs.length-1]}</li>);

Final code:

import'./BreadCrumb.css';
import {crumbs} from'./data';

function BreadCrumb() {
//const crumbs=["Home","Service","Suche"];
let bcLi=[];
for (let i=0; i<crumbs.length-1;i++) 
{
  bcLi.push(<li className="breadcrumb-item" key={1}>{crumbs[i]}</li>);
}
bcLi.push(<li className="breadrumb-item active" key={crumbs.length-1} 
aria-current="page">{crumbs[crumbs.length-1]}</li>);

return (
  <div className="bcd">
    <nav aria-aria-label="breadcrumb">
      <ol className="breadcrumb">
        {bcLi}
      </ol>
    </nav>
  </div>
);
}

export default BreadCrumb;
about 4 years ago · Juan Pablo Isaza Relatório
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