Last active
December 18, 2019 23:49
-
-
Save reciosonny/a70189eabec5140fd740d9ca35e7e3e4 to your computer and use it in GitHub Desktop.
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
| export default class ContainerComponent extends Component { | |
| state = { firstName: "", lastName: "", address: "", data: [] }; | |
| componentDidMount() { | |
| axios.get("/url/blablabla").then(res => this.setState({ data: res.data })); | |
| } | |
| onChangeEvent = () => { | |
| // Complex logic here... | |
| } | |
| onComputeComplexFormulas = () => { | |
| // Complex logic here... | |
| } | |
| render() { | |
| const { firstName, lastName, address } = this.state; | |
| return ( | |
| <div> | |
| <DumbComponent firstName={firstName} lastName={lastName} address={address} /> | |
| </div> | |
| ) | |
| } | |
| } |
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
| const DumbComponent = ({ firstName, lastName, address }) => { | |
| return ( | |
| <div> | |
| My complete information: | |
| <h3>{firstName}</h3> | |
| <h3>{lastName}</h3> | |
| <h3>{address}</h3> | |
| </div> | |
| ) | |
| } | |
| export default DumbComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment