Skip to content

Instantly share code, notes, and snippets.

@reciosonny
Last active December 18, 2019 23:49
Show Gist options
  • Select an option

  • Save reciosonny/a70189eabec5140fd740d9ca35e7e3e4 to your computer and use it in GitHub Desktop.

Select an option

Save reciosonny/a70189eabec5140fd740d9ca35e7e3e4 to your computer and use it in GitHub Desktop.
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>
)
}
}
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