Skip to content

Instantly share code, notes, and snippets.

@mageddo
Created January 9, 2019 03:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mageddo/b601a27ed267f0721d7dc2c46537cbbe to your computer and use it in GitHub Desktop.
Save mageddo/b601a27ed267f0721d7dc2c46537cbbe to your computer and use it in GitHub Desktop.
Manipulando Componentes
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