How to remove a ion-accordion from the ion-accordion-group?

how to remove a ion-accordion from the ion-accordion-group?

const refAccordionGroup = useRef<HTMLIonAccordionGroupElement>(null);

refAccordionGroup.current?.value could get the values of ion-accordion.
how to get the index of ion-accordion?
with the index, it could remove ion-accordion easily.


the code below not work:

for (let i=0; i<refAccordionGroup.current.children.length; i++) {

TS2339: Property ‘value’ does not exist on type ‘Element’.

how to do? thanks.

or, it 's better practice to useEffect() to remove data from source to render every time?

how to binding data with ion-accordion-group to render ion-accordion?

it’s not working with this:

<IonAccordionGroup ref={refAccordionGroup}>{  //it may need a data binding here,
	Object.keys(data).map((key,index) => (