${page.label}`" /> ${page.label}`" /> ${page.label}`"/>

Type error - .push is not a function when using .map

133 Views Asked by At

I have this function in my codebase,

const renderList = (listItems) => listItems.map((page) => html`<li><a href="${page.link}">${page.label}</a></li>`);

const renderSection = (siteMapContent) => html`
    <div class="p-site-map">
        ${siteMapContent.map((sitemapItem) => html`
            <div class="g-col-12 g-col-md-6 g-col-xl-3 sm:u-mt-12">
                ${sitemapItem.section}
                <ul>
                    ${renderList(sitemapItem.pages)}
                </ul>
            </div>
    </div>`)}`;

I am getting the following being thrown,

TypeError: (intermediate value)(intermediate value).push is not a function

at the line, ${siteMapContent.map((siteMapItem) => html

I am not clear what this error means as the syntax looks fine to me.

0

There are 0 best solutions below