Hello everyone, I have to detect which segment has been selected and show content based on that.
For this purpose I use the event onIonChange and that it calls a “Seleccionado” function.
This function has to receive the value parameter which is what has been selected but I have an error.
Could you please help me detect and solve the error
(property) CustomEvent.detail: SegmentChangeEventDetail
Returns any custom data event was created with. Typically used for synthetic events.Argument of type ‘string | undefined’ is not assignable to parameter of type ‘string’.
Type ‘undefined’ is not assignable to type ‘string’.ts(2345)
class Segmentos extends Component{
Seleccionado = (seleccion: string) =>{
if(seleccion==="pendientes"){
}
}
render(){
return(
<IonSegment onIonChange={e => this.Seleccionado(e.detail.value)} >
<IonSegmentButton value="pendientes">
<IonLabel>Servicios Pendientes</IonLabel>
</IonSegmentButton>
<IonSegmentButton value="curso">
<IonLabel>Servicios en Curso</IonLabel>
</IonSegmentButton>
</IonSegment>
);
}
};