Skip to content

Instantly share code, notes, and snippets.

@fay-jai
Last active February 10, 2016 00:17
Show Gist options
  • Save fay-jai/5d70c14389c12af159bd to your computer and use it in GitHub Desktop.
Save fay-jai/5d70c14389c12af159bd to your computer and use it in GitHub Desktop.
import React from "react";
import { render } from "react-dom";
const ParentComponent = React.createClass({
getDefaultProps: function() {
console.log("Step 1 (invoked once) => GetDefaultProps");
},
getInitialState: function() {
console.log("Step 2 (invoked once) => GetInitialState");
return { text: "" };
},
componentWillMount: function() {
console.log("Step 3 (invoked once) => ComponentWillMount");
},
render: function() {
console.log("Step 4 (invoked multiple times) => Render");
return <div>I got rendered!</div>;
},
componentDidMount: function() {
console.log("Step 5 (invoked once) => ComponentDidMount");
},
componentWillUnmount: function() {
console.log("Step 6 (invoked once) => ComponentWillUnmount");
}
});
render(
<ParentComponent />,
document.getElementById("root")
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment