Search code examples
javascriptreactjsmaterial-uireact-bootstrap

Error showing up on importing modal popup


Hi I am trying to import modal popup in react-bootstrap but it is showing the following error: Props not defined> I took it from react-bootstrap documents but am not able to understand the error

/src/components/AddProcessModal.js
  Line 24:28:  'props' is not defined  no-undef

Here is the code:

export class AddProcessModal extends Component {
  constructor(props) {
    super(props);
  }

  render() {
    return (
      <Modal
        {...this.props}
        size="lg"
        aria-labelledby="contained-modal-title-vcenter"
        centered
      >
        <Modal.Header closeButton>
          <Modal.Title id="contained-modal-title-vcenter">Add KPI</Modal.Title>
        </Modal.Header>
        <Modal.Body>
          <div className="container">Add KPI Fields for BPMS</div>
        </Modal.Body>
        <Modal.Footer>
          <Button onClick={props.onHide}>Close</Button>
        </Modal.Footer>
      </Modal>
    );
  }
}
export default AddProcessModal;

Solution

  • Please check this part.

     <Modal.Footer>
              <Button onClick={this.props.onHide}>Close</Button>
     </Modal.Footer>
    

    It should be this.props.onHide instead of props.onHide.