yaodingyd / react-flickity-component

A React.js component for using @desandro's Flickity
314 stars 51 forks source link

Issues with updating Flickity's options during runtime #61

Closed Alexius08 closed 5 years ago

Alexius08 commented 5 years ago

Changing Flickity's options during runtime doesn't seem to trigger a rerender. The options are controlled by variables from state, yet updating them doesn't seem to have an effect. Updating props connected to this.state doesn't work. This.forceUpdate() doesn't work either. What worked, though, is making the component appear or disappear by toggling a boolean variable. Is there a better approach that I missed?

https://codesandbox.io/s/j74ry6w38v

Alexius08 commented 5 years ago

Turns out that giving the flickity component a key that changes every time an option changes would do the same.