IonSlides with useState

Hi, i have this code.

<IonSlides key="elSlide" pager={true} options={slideOpts}>
                    { => {
                      return (
                          onClick={() => {
                              imagenes: infoDeportista.imagenes?.filter(
                                (foto) => !==
                          style={{ position: "relative" }}
                          <img className="bordeRedondo" src={imagen.url}></img>

I want that when i click on the slide, the slider disappear. but im getting this error.
Uncaught DOMException: Node.removeChild: The node to be removed is not a child of this node
Only happens with the ionSlide… if i remove it works fine… greetings

Not sure but you could wait a frame like this:

const handleClick = useCallback(() => {
  requestAnimationFrame(() => {
}, [])

return (
    <IonSlide onClick={handleClick}

the underlying swiperjs API does like you directly removing or adding slides in that manner. I spent a few hours trying all sorts of solutions but all failed

1 Like

I will try Max, thx.