(react.js)why React Cannot Find The Object?
I am a newbie learning to build a rpg game with React.js, and I found this part very confusing. I am trying to update life with onClick and when life
Solution 1:
I know what i am wrong:
when I am dropping a object, I should move the index back:
if (life>damage){
players[index2].life = life-damage;}
else {players=players.filter(player => player.id !== id2);
this.setState({playerindex:this.state.playerindex-1});}
This problem is solved, however please give me advice on this project if you like!
Post a Comment for "(react.js)why React Cannot Find The Object?"