Created
August 3, 2017 04:04
-
-
Save sirgallifrey/f83148f53f35d67739ca8f63a9be5078 to your computer and use it in GitHub Desktop.
props.children composition
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 from 'react'; | |
function Card (props) { | |
return ( | |
<div className={`card ${props.className}`}> | |
{ props.children } | |
</div> | |
); | |
} |
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 from 'react'; | |
import Card from './card'; | |
function Dashboard (props) { | |
return ( | |
<div> | |
<Card> | |
<h1>Título do card</h1> | |
<p>Texto</p> | |
</Card> | |
<Card> | |
<img src="/some/image.png"/> | |
<h2>Car com imagem</h2> | |
</Card> | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment