Fixed React Modal.js bug
This commit is contained in:
parent
3aedb93bbe
commit
2be9b87795
|
@ -16,7 +16,10 @@ export default class Modal extends React.Component {
|
||||||
|
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
console.log("Modal Created");
|
// Probably should remove once done with debugging
|
||||||
|
if (this.state.style.display === "flex") console.log("Modal Show")
|
||||||
|
else console.log("Modal Hide");
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<div
|
<div
|
||||||
className="modal"
|
className="modal"
|
||||||
|
@ -28,15 +31,11 @@ export default class Modal extends React.Component {
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
shouldComponentUpdate(nProps, nState) {
|
shouldComponentUpdate(props, state) {
|
||||||
|
return this.state.style.display !== state.style.display
|
||||||
return (
|
|
||||||
this.props.content !== nProps.content ||
|
|
||||||
this.state.display !== nState.style.display)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
handleClick() {
|
handleClick() {
|
||||||
console.log("Dismissing Modal.");
|
|
||||||
this.setState({
|
this.setState({
|
||||||
style: { display: "none" }
|
style: { display: "none" }
|
||||||
});
|
});
|
||||||
|
|
Reference in New Issue