Can you post more code, so that i can find out why are you getting that function error ?
Function Is Not Defined Error in React
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);
})
}