0
votes
if ((password2 != password) || (email == "")) {
        console.log("P2: " + password2)
        console.log("P1: " + password)

        if(password2 != password){
            this.setState({
                passwordMatchFailure: true
            })
        }else{
            this.setState({
                emailCantBeBlank: true
            })
        }

Why is the second setState returning Expected an assignment or function call and instead saw an expression

It seems to be fine

2
please provide your class component - amitchauh4n
Ive just deleted it and written it again and now it works. No sense - mouchin777

2 Answers

1
votes

if block was not closed properly

if ((password2 != password) || (email == "")) {
    console.log("P2: " + password2)
    console.log("P1: " + password)

    if (password2 != password) {
        this.setState({
            passwordMatchFailure: true
       })
    }

    else {
        this.setState({
            emailCantBeBlank: true
        })
    }
}
0
votes

I don't know. missing curly bracket }

if (password2 !== password) {
    this.setState({
        passwordMatchFailure: true
    });
}
if (email === '') {
    this.setState({
        emailCantBeBlank: true
    });
}