Last active
April 24, 2018 15:54
-
-
Save himanoa/078e5304052a0ec51a5c468a37b0e11d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Component } from "React"; | |
export const withModal = (InnerComponent) => class extends Component { | |
constructor() { | |
this.state = { visible: false }; | |
} | |
render() { | |
<div> | |
<InnerComponent visibleModal={() => this.setState({ visible: true })}/> | |
<Modal close={() => this.setState({ visible: false })} isVisible={this.state.visible} /> | |
</div> | |
} | |
}; | |
// Modalは中でisVisibleを見て |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment