Skip to content Skip to sidebar Skip to footer

Remove Previous Events From State Object In Reactjs

I have a button Mic-off and Mic-on which is a toggle achieved using ternary operation. events(JSON array) is a list of JSON Object with event_name and date_time. {this.props.events

Solution 1:

As this.state.micStates is an array. Keep a flag like "isPlaying: true/false". By default it will be false. Once you will call play/start record pass the array index and do a simple operation array find and update.Only that passed key will be set as true and rest false as you will do looping.


Post a Comment for "Remove Previous Events From State Object In Reactjs"