score:1

Accepted answer
if (milestoneBtnLabel === "Create") {
  this.setState(
    {
      campus: this.state.campus.concat(schoolData.schoolData.name)
    },
    () => {
      console.log("here"); <-- Doesn't execute
      this.props.saveChecklistItem({ ...this.state });
      this.props.closeModal();
    }
  );
else {
  this.props.closeModal();
}

score:0

    onSubmit = e => {
    const { milestoneBtnLabel, schoolData, closeModal, saveChecklistItem} = this.props;
    e.preventDefault();

    if (milestoneBtnLabel === "Create" && schoolData && schoolData.schoolData){
    this.setState( prevState => (
        {
          campus: [...prevState.campus, schoolData.schoolData.name]
        }),
        () => {
          console.log("here"); <-- Doesn't execute
          saveChecklistItem({ ...this.state });
        }
      );
     }
      setTimeout(()=>{
           closeModal();
       }, 2000);
    }

Related Query

More Query from same tag