Ionic 4 + React: How Can I close an IonItemSliding?

How can I close an IonItemSliding programatically?

I have an IonItemSliding and when the user select an option I need close ten item after I run the process

<IonItemSliding key={props.atleta.codigo}>
            <IonItem >
                <IonAvatar slot="start">
                    <img src={foto} />
                    <IonText color="primary">
                        <p>Desde:{new Date(props.atleta.fechadesde).toLocaleDateString()}<span> Hasta:{new Date(props.atleta.fechahasta).toLocaleDateString()}</span></p>
                    <IonText color={colorEstatus(props.atleta.fechahasta)}>
            <IonItemOptions side="end">
                <IonItemOption onClick={props.onAplicarCreditos.bind(this)}>Aplicar Créditos</IonItemOption>

In the onAplicarCreditos function I like close the item.

await document.querySelector("ion-item-sliding").closeOpened();
1 Like

Also you can do:

const ref = useRef(null):

<IonItemSliding key={props.atleta.codigo} ref={element => {
  ref.current = element;

And then later: