#Mapping Errors

2 messages · Page 1 of 1 (latest)

junior edge
#

When i try to map items from a string[] of items from firestore , only the first item gets its tailwind styling applied, the others don't.
app-index.js:31 Warning: validateDOMNesting(...): <div> cannot appear as a descendant of <p>.
app-index.js:31 Warning: validateDOMNesting(...): <p> cannot appear as a descendant of <p>.
app-index.js:31 Warning: validateDOMNesting(...): <ul> cannot appear as a descendant of <p>.
app-index.js:31 Warning: Each child in a list should have a unique "key" prop.

All these errors shoudn't occur

`
{order && productInfo && (
<ul>
{productInfo.map((product, index) => (
<li className="flex mt-5" key={index}>
<div>
<img
src={product.mainImage}
className="w-20"
alt={product.name}
/>
</div>

              <div className="mx-auto">
                <p className="text-3xl">{product.name}</p>
                <p className="text-2xl">{product.price} лв.</p>
              </div>
            </li>
          ))}
        </ul>
      )}

`

shadow jungleBOT
#

🔎 This post has been indexed in our web forum and will be seen by search engines so other users can find it outside Discord

🕵️ Your user profile is private by default and won't be visible to users outside Discord, if you want to be visible in the web forum you can add the "Public Profile" role in id:customize

✅ You can mark a message as the answer for your post with Right click -> Apps -> Mark Solution
(if you don't see the option, try refreshing Discord with Ctrl + R)