I need a Submit button to update this.state.FormStatus. I will use this state to save to an SP list. But I'm a rookie and getting the well-known stale state issue. I understand that I need to pass a callback to setState. But I don't know how with my code.
I've tried this:
But the syntax is wrong.
private _onSubmit() {
    this.setState(function(prevState, props) {
      return {
      FormStatus: prevState.FormStatus: 'Submitted',
      SubmittedLblVis: !prevState.SubmittedLblVistrue,
      };
  });
Here is the rest of the Submit and I've corrected the code above, which may help clear things up:
 private _onSubmit() {
    this.setState(prevState =>({
      FormStatus: 'Submitted',
      SubmittedLblVis: true,
  }));
      pnp.sp.web.lists.getByTitle("JobEvaluationItems").items.add({
        JobTitle: this.state.JobTitle,
        Faculty: this.state.Faculty,
        Department: this.state.SelectedDept,
        SubDepartment: this.state.SubDepartment,
        DeptContactId: this.state.DeptContact,
        FormStatus: this.state.FormStatus
As you can see on the last line of code above, I'm trying to update an SP list with the latest this.state.FormStatus. I expect the Submit button to add 'Submitted' to this.state.FormStatus
 
    