Closed Kinark closed 6 years ago
hey @Kinark I'll take a look into this and get back to you.
@Kinark So I've been thinking of some ways to allow this package to use dynamic children but haven't come up with anything super useful. Flickity expects cells to be added and removed with the .append
/ .insert
and .remove
methods. It also expects these to be native DOM elements not react elements so the children can't be passed to these methods internally without first being converted to DOM elements. So my thoughts are either it internally needs to create the DOM elements from children and pass them to the flickity methods or alternatively I just expose these methods as props on the component and let end users handle this. Both options don't sound super appealing. Any ideas? / thoughts?
Forcing the user to manage the elements "by hand" IMO breaks the beauty of React. I'd expect the component to "just work". Whatever black magic is required should be contained in the component.
@Ismael yeah I tend to agree, if I put up a test branch would you be willing to help out testing this?
Sure
@theolampert I can also help you test this, are you working on this?
@92arpitgoyal @Ismael I'm hoping #16 will solve this and a few other issues.
I'm trying to add cells dynamically by mapping a state object and remapping after an ajax call ends:
However, what I get rendered after the ajax call is something like this:
I mean, if I have more cells in the remap than I had before, they're added outside the viewport and the slider. And if I have less cells in the ajax call than I had before, I got an error:
Uncaught DOMException: Failed to execute 'removeChild' on 'Node': The node to be removed is not a child of this node.
Is it a bug or am I doing something wrong?