Last active
March 30, 2020 17:04
-
-
Save akexorcist/897bc995ec0e84a8a630629f8945e53a to your computer and use it in GitHub Desktop.
[Child > Parent > Child] FirstChildComponent - 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' | |
... | |
class FirstChildComponent extends Component { | |
... | |
onConfirmClick = () => { | |
const order = ... | |
if (this.props.confirm) { | |
this.props.confirm(order) | |
} | |
} | |
render() { | |
return ( | |
<React.Fragment> | |
... | |
<button onClick={this.onConfirmClick}>Confirm</button> | |
</React.Fragment> | |
) | |
} | |
} | |
export default FirstChildComponent |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment