React-id-swiper: Force ReRender When .map Completes

Created on 11 May 2018  路  5Comments  路  Source: kidjp85/react-id-swiper

Hello,

I am trying to use the swiper by populating it with a variable number of components based on an array. However, it seems the swiper needs to be rerendered after the map completes.

const colorParams = {
  slidesPerView: 3,
  spaceBetween: 30,
  freeMode: true,
  rebuildOnUpdate: true
};
<Swiper {...colorParams}>
  {
    ColorOptions.map((color) => {
      return (
        <ColorCircle /> /* puedo component code */
      );
   })
 }
</Swiper>

I don't see anything in the docs about this and am hoping I'm just missing something. All of my other testing looks to work fine up until I try to populate the slider with a map method.

Most helpful comment

It's not working!

All 5 comments

Hi @yuschick , u can use params rebuildOnUpdate: true or shouldSwiperUpdate : true. If u wanna rebuild Swiper each time component got re-rendered , just use rebuildOnUpdate. If u wanna update Swiper only, just use shouldSwiperUpdate

worked like a charm i was using it in params but should be used like below

It's not working!

In your object colorParams include the following propertie

rebuildOnUpdate: true

Neither props are recognized by react...

React does not recognize the rebuildOnUpdate prop
React does not recognize the shouldSwiperUpdate prop

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Fenopiu picture Fenopiu  路  3Comments

spostad7 picture spostad7  路  6Comments

xinconan picture xinconan  路  6Comments

Pixel-Daze picture Pixel-Daze  路  4Comments

d4n1b picture d4n1b  路  5Comments