Last active
March 30, 2020 17:04
-
-
Save akexorcist/e8e9f2c03337d4aad26af4c353cffba2 to your computer and use it in GitHub Desktop.
[Parent > Data > Child] ParentComponent - Code Snippet for https://blog.nextzy.me/การส่งข้อมูลระหว่าง-parent-และ-child-componentใน-react-725eb793de7b
This file contains hidden or 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 React, { Component } from 'react' | |
import ChildComponent from './ChildComponent' | |
... | |
class ParentComponent extends Component { | |
constructor(props) { | |
super(props) | |
this.state = { | |
buttonVisibility: false | |
}; | |
} | |
... | |
render() { | |
return ( | |
<React.Fragment> | |
... | |
<ChildComponent buttonVisibility={this.state.buttonVisibility} /> | |
</React.Fragment> | |
) | |
} | |
} | |
export default ParentComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment