I am using mdbreact modal in my react application but facing some issue. I try to include the modal component in my page, but the modal is not open yet, inspite of that it is applying a class 'modal-open' to the body tag which stops body from scrolling.
My code is as follows:
import React, { Component } from 'react';
import { Modal, ModalBody, ModalHeader, ModalFooter } from 'mdbreact';
class GroupContainer extends Component {
constructor() {
super();
this.state = {
modal: false,
}
}
renderModal = () => {
this.setState({
modal: true,
})
}
closeModal = () => {
this.setstate({
modal: false,
})
}
render() {
return (
<div>
<Modal isOpen={this.state.modal} toggle={() => this.renderModal()} fullHeight position="bottom">
test
</Modal>
</div>
)
}
};
export default GroupContainer;
The state 'modal' is false still the modal-open class is getting applied. It must get applied only when the state is true. I will be making the state as true on click of an external button in order to show this modal. Any clue?