chain setState multiple times

Viewed 245

Hello React specialists,

I'm working on an application and I ended up chaining setState for 3 times like this:

this.setState({}, () => {
    // first call back 
    this.setState({}, () => {
        // second call back
        this.setState();
    })
})

Now, state logic is working fine, I faced some unexpected unexplained behaviour, like: inputs UI are not changing although the state does. and some other stuff with no reason why it's happening.

question is: have you expected problems while using this chain ?? why it's bad to do this ?? do you think that this chaining might be the root of the problem ??

0 Answers
Related