导入模式弹出窗口时出现错误
2020-08-29
707
嗨,我正在尝试在 react-bootstrap 中导入模式弹出窗口,但它显示以下错误:Props not defined> 我从 react-bootstrap 文档中获取了它,但无法理解错误
/src/components/AddProcessModal.js
Line 24:28: 'props' is not defined no-undef
这是代码:
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;
1个回答
请检查此部分。
<Modal.Footer>
<Button onClick={this.props.onHide}>Close</Button>
</Modal.Footer>
它应该是
this.props.onHide
,而不是
props.onHide
。
Kevin Moe Myint Myat
2020-08-29