Skip to content

Update component when data changes #3

@lucilk

Description

@lucilk

Is there a way to update the component when the data changes?
I call the component like this:
<ImageGallery items={QuoteGallery} lazyLoad={true} />

I populate the gallery array in this function which is called before rendering

  function getGallery() {
    const wesiteMediaUrl = "https://website.com/media";

    imgGallery = somObjectData.gallery.map((image) => {
      return {
        original: wesiteMediaUrl + image,
        thumbnail: wesiteMediaUrl + image
      };
    });

  }

When a dropdown changes i call the getGallery function to update the data in imgGallery but only the thumbnails are updated, not the main image.

How do i make the component redraw the thumbnails and main image when the imgGallery changes?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions