glennflanagan / react-collapsible

React component to wrap content in Collapsible element with trigger to open and close.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Display multiple items in a map when a Collapsible is clicked

cardinalpipkin opened this issue · comments

User clicks an item in the collapsible and it calls data that populates a mapped list:

{items.map((element, i) => (
        <Collapsible trigger={element.Title} key={i} onOpening={() => getAssociatedSitesForCollapsible(element)} >
          {associatedSites.length > 0 ? associatedSites.map((associatedSite: any) => {
            <p>{associatedSite.siteUrl}</p>
          }) : null}
        </Collapsible>
      ))}

It's not doing anything - I've checked what props I'm passing and it's populating state for the associatedSites state.
Not a bug - but I just don't know how to do it with Collapsible.

Doh - wasn't returning the map.