1

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.

Udders
  • 6,914
  • 24
  • 102
  • 194
  • Are you using React or some other framework? I'm not familiar with the `html\`` syntax – phuzi Dec 21 '21 at 12:53
  • Nevermind, it's a tagged template literal. No framework necessary. Can we see your `html` function? – phuzi Dec 21 '21 at 12:57

0 Answers0