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;
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;