Created
October 13, 2018 20:39
-
-
Save prof3ssorSt3v3/ea3151d540af67a2101c4a4e0e700834 to your computer and use it in GitHub Desktop.
This file contains 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, Fragment} from 'react'; | |
import BigBrother from './BigBrother'; | |
import LittleSister from './LittleSister'; | |
import LittleBrother from './LittleBrother'; | |
export default class Parent extends Component{ | |
/**** | |
A component with a render prop takes a function | |
that returns a React element and calls it | |
instead of implementing its own render logic. | |
A common practice is to call it render but the prop | |
can be whatever you want. | |
****/ | |
render(){ | |
return ( | |
<Fragment> | |
<BigBrother copycat={ (brother) => ( | |
<Fragment> | |
<LittleSister bgcolor="pink" brother={brother} /> | |
<LittleBrother bgcolor="skyblue" brother={brother} /> | |
</Fragment> | |
)}/> | |
</Fragment> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment