Created
January 9, 2019 03:36
-
-
Save mageddo/b601a27ed267f0721d7dc2c46537cbbe to your computer and use it in GitHub Desktop.
Manipulando Componentes
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
class List extends React.Component { | |
constructor(props){ | |
super(); | |
this.props = props; // todas as propriedades setadas no List virao para ca | |
} | |
render() { | |
return ( | |
<ul {...this.props} > // todas as propriedades setadas no List setarao aqui | |
{this.props.children} // todos os elementos passados dentro do List aparecerao aqui | |
</ul> | |
); | |
} | |
} | |
ReactDOM.render( | |
<List style={{backgroundColor: "red"}}> | |
<li style={{backgroundColor: "green"}}>Item a</li> | |
</List>, | |
document.getElementById('root') | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment