Skip to content

Instantly share code, notes, and snippets.

@pedroparra
Last active August 29, 2015 14:27
Show Gist options
  • Select an option

  • Save pedroparra/fb3efd4f63459891f6a7 to your computer and use it in GitHub Desktop.

Select an option

Save pedroparra/fb3efd4f63459891f6a7 to your computer and use it in GitHub Desktop.
React Js componentWillMount
// Ecmascript 5
var MyComponent = React.createClass({
componentWillMount: function() {}
console.log('El componente aun no está disponible en el DOM');
return { data:[] };
},
render: function() {
<div>Soy un component</div>
}
});
// Ecmascript 6
class MyComponent extends React.Component {
constructor(props){
super(props);
this.state = { data: [] }
console.log('El componente aun no está disponible en el DOM');
}
render(){
<div>Soy un component</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment