You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while passing this.state in addNinja() function, we are actually passing the state of 'AddNinja' component directly as reference to the function. So this 'AddNinja' state is directly being modified :
addNinja=(ninja)=>{ninja.id=Math.random();// state modified directly herethis.setState({ninjas: [...this.state.ninjas,ninja]});}
here an id is added directly to 'AddNinja' state which should not be done and hence gives me error when i give submit on same data more than once.
The text was updated successfully, but these errors were encountered:
over here :
while passing this.state in addNinja() function, we are actually passing the state of 'AddNinja' component directly as reference to the function. So this 'AddNinja' state is directly being modified :
here an id is added directly to 'AddNinja' state which should not be done and hence gives me error when i give submit on same data more than once.
The text was updated successfully, but these errors were encountered: