Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active March 30, 2020 17:04
Show Gist options
  • Save akexorcist/327059c1c2b00aa35af64907285b039e to your computer and use it in GitHub Desktop.
Save akexorcist/327059c1c2b00aa35af64907285b039e to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'
import FirstChildComponent from './FirstChildComponent'
import SecondChildComponent from './SecondChildComponent'
...
class ParentComponent extends Component {
constructor(props) {
super(props)
this.state = {
isOrderConfirm: false
};
}
...
onConfirm = (order) => {
this.setState({
isOrderConfirm: true
})
}
render() {
return (
<React.Fragment>
<FirstChildComponent confirm={this.onConfirm} />
<SecondChildComponent isOrderConfirm={this.state.isOrderConfirm} />
</React.Fragment>
)
}
}
export default ParentComponent
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment