HomeHomeCommunityCommunityCollectionsCollectionsFind JobsFind JobsTagsTagsAsk a questionAsk a question

Function Is Not Defined Error in React

asked on

asked 4 months ago

answers

1Answers

views

46Views

I am trying to call a function from componentDidMount which sets the State but keep coming across an error of

Uncaught ReferenceError: setPanelState is not defined

Below is the code...

export default class Patient extends React.Component {
  constructor(props) {
    super(props);
    autoBind(this);

    this.state = {
     PATIENT: [],
     COMPPROPS: [],
    };

    this.setPanelState = this.setPanelState.bind(this);
  }

    setPanelState(activity) {
          this.setState({COMPPROPS: [{compName:'Overview', compState:'Edit'}]});
    }

    componentDidMount() {   
       //handles chat commands and if the command is update patient the Overview panel should change to editable
       this.directLine.activity$
        .filter(function (activity) {
          return activity.type === 'event' && activity.value === 'Update Patient';
       })
       .subscribe(function (activity) {
         setPanelState(activity);   
       })
  }

1 Answers

Write your answer here

Top Questions