Reputation: 69
I'm using react-bootstrap in my project. Getting an error like below while I am using Modal component.
modal component:
<Modal show={this.state.modalshow} onHide={close} container={this} aria-labelledby="contained-modal-title">
<Modal.Header closeButton>
<Modal.Title id="contained-modal-title">Add User</Modal.Title>
</Modal.Header>
Upvotes: 5
Views: 5570
Reputation: 483
It seems to be not Modal issue.
it happened if you are using any undefined value but it doesn't mean that Modal.Header is not undefined.
Upvotes: 0
Reputation: 726
At First Install React bootstrap with following command -
npm install --save react-bootstrap
After that import Modal
from react-bootstrap
import {Button,Modal} from 'react-bootstrap'
<Button bsStyle="primary" type="submit">Create</Button>
if this code works for you i.e. react-bootstrap working fine and try with your modal code will work fine.
else you have a problem with react-bootstrap installation.
Upvotes: 0
Reputation: 1023
Try Adding at Top
import Modal from 'react-bootstrap/lib/Modal';
// or
import { Modal } from 'react-bootstrap';
Upvotes: 2