Here I am getting small issue with setState() . I know this setState() is an asynchronous function. I have gone some example from SO example as well and I am getting my value in console.log() but this same is not updating in state.
What should I need to change here to get the updated state() value. Any suggestion for me please.
Here in my code on tab change the state value should be updated for form submission.
//Code
handleOnSubmitJoinUS(e) {
    e.preventDefault();
    const { name,  phone, email, comment, activeTab } = this.state;
    if (activeTab == 0 ) {
        this.setState({comment: "Message for : Becoming a team member"}, () => {
            console.log(this.state.comment);
        });
    } else if (activeTab == 1) {
        this.setState({comment: "Message for : Becoming a Vendor Partner"}, () => {
            console.log(this.state.comment);
        });
    } else {
        this.setState({comment: "Message for : Becoming a Designer Associates"}, () => {
            console.log(this.state.comment);
        });
    }
    
    
    const sendingMsgData = {
        name,  phone, email, comment
    }
    //attempt to login
    if (sendingMsgData.email && sendingMsgData.name && sendingMsgData.phone  != null  ) {
        this.setState({msg : "Thank you! we recieved your submission successfully, we will surely contact you within 24 hours"});
        window.setTimeout(function(){window.location.reload()}, 1000);
    } 
    this.props.sendingConsultation(sendingMsgData);
    
}
 
    