Fixed React Modal.js bug

This commit is contained in:
Paoda 2019-02-08 19:44:07 -06:00
parent 3aedb93bbe
commit 2be9b87795
1 changed files with 6 additions and 7 deletions

View File

@ -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" }
}); });