for example, I have a list state like this:
this.state={list:[1,2,3,4,5]}How can I change the value of the first item of list from 1 to 0?
I usually use like this but I don't believe that is the best way.
vartemp=this.state.list;temp[0]=0;this.setState({list : temp});Please who can tell me is there any better way to do this ?
for example, I have a list state like this:
How can I change the value of the first item of list from 1 to 0?
I usually use like this but I don't believe that is the best way.
Please who can tell me is there any better way to do this ?