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
handleCategoryCheck(changeEvent){varcategory=changeEvent.target.valueconsole.log("CHECK CATEGORY:",category)varuserCategories=this.state.userCategoriesvarcategoryIndex=userCategories.indexOf(category)// will be -1 if item not in arrayif(categoryIndex>=0){userCategories.splice(categoryIndex,1)// remove 1 item from array at the given position}else{userCategories.push(category)}console.log("CATEGORIES:",userCategories)this.setState({userCategories: userCategories})// this is updating state but why not triggering a re-render?}
The text was updated successfully, but these errors were encountered:
Translate this react code into a simple example:
The text was updated successfully, but these errors were encountered: