Home > Net >  .map is not a function with Styled Component in React
.map is not a function with Styled Component in React

Time:09-17

I have this small code block that returns the error:

"TypeError: object.attributeCollection.first.map is not a function"

      <StyledRow>
        {object.attributeCollection.first.map((attribute) => (
          <LabelAssistant attribute={attribute} />
        ))}
      </StyledRow>

The object in the console looks like this:

enter image description here

Can anyone suggest where I might be going wrong?

CodePudding user response:

map is an Array method. first being a StringAttributeModel is not an Array.

  • Related