1

I have a string vector that I'm gettig from js, when this variable has just one element the image is rendered. Below is my code (to work with one element I have to comment template). What is the right way to render images in carousel, maybe I'm missing the key value here.

                <template for:each={img} for:item="rec" for:index="index">                  
                    <lightning-carousel-image
                        key= "rec"
                        src={rec.img}
                        header="Image"
                        description="Image"
                        alternative-text="This is a card">
                    </lightning-carousel-image>
                </template>
1

You can use the img src as the key:

key={rec.img}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.