Replies: 6 comments
-
Do you mean you can not add slides? |
Beta Was this translation helpful? Give feedback.
-
I can add slides. Maybe I can sketch the problem more precisely with some pseudo code: My component returns the following:
The
By clicking on the button, I add a new child, which renders the same content with the While the child gets added successfully, Splide doesn’t update the slides accordingly. I need to manually do a Thus I wonder if there’s another solution where Splide recognizes the change outside of its component? |
Beta Was this translation helpful? Give feedback.
-
Your component seems not to re-render the How about using a state: const [ children, setChildren ] = useState( [] );
return (
<Splide ref={ splideRef }>
<Fragment children={ children } />
</Splide>
<Button onClick={ () => setChildren( [ ...children, newChild1 ] ) } />
); Or if you are using a class component: |
Beta Was this translation helpful? Give feedback.
-
Yes, I used something like that now. But the problem with the deletion still persists where I don’t have any possibility to hook into. |
Beta Was this translation helpful? Give feedback.
-
How do you remove the slide? |
Beta Was this translation helpful? Give feedback.
-
It’s via an external component, which dispatches an action to remove it. |
Beta Was this translation helpful? Give feedback.
-
I’m currently trying to use Splide in a react project where it’s possible to add new slides outside of
splide.add()
. This also updates the component. However, Splide doesn’t recognize this component update, even if it should.Any idea where I can start digging for a solution?
Beta Was this translation helpful? Give feedback.
All reactions