I have a class where I render a modal, like this:
import Modal from 'Modal';
export default class SomeClass extends Component {
constructor(props) {
super(props);
this.state = {
modal: null
}
}
render() {
return (
<Modal />
);
}
}
I want to initialize the modal as a Bootstrap modal so that I can call methods like .show() from SomeClass and have the modal show up. I need to thus call:
var myModal = new bootstrap.Modal(document.getElementById('myModal'), options)
And save it's state, but I don't want to use getElementById... I would rather just reference it directly. How would I do this in React?
Comments
Post a Comment