mardi 7 avril 2020

React js, state won't update with my if and else statements

console just keeps logging BOOM VOOM ? is there a reason for this or is it just not recognising the string value , i'm new to JS and React.

constructor() {
super()
this.state = {
    message: "CLAY"
}
}

changeMessage = () =>{

let mm = this.state.message

console.log(mm)

if (mm = "CLAY"){
this.setState({
    message: "BOOM VOOM"
})
} else {
this.setState({
    message: "CLAY"
})
}


}



Aucun commentaire:

Enregistrer un commentaire