From ae6700abfd2e11565c5b72756e190de9479bbe84 Mon Sep 17 00:00:00 2001 From: "Rico Sta. Cruz" Date: Thu, 26 Feb 2015 15:14:22 +0800 Subject: [PATCH] Update React --- react.md | 38 ++++++++++++++++++++++++++------------ 1 file changed, 26 insertions(+), 12 deletions(-) diff --git a/react.md b/react.md index ec6317ca9..877f8a119 100644 --- a/react.md +++ b/react.md @@ -49,22 +49,36 @@ c.forceUpdate() c.isMounted() ``` +### [Methods](http://facebook.github.io/react/docs/component-specs.html) + +```js +{ + render: function() + getInitialState: function() + getDefaultProps: function() + mixins: [] + propTypes: {} /* for validation */ + statics: { .. } /* static methods */ + displayName: '..' /* automatically filled in by jsx */ +} +``` + ### [Lifecycle](http://facebook.github.io/react/docs/component-specs.html) - render: function() - getInitialState: function() - getDefaultProps: function() - propTypes: {} - mixins: [] - statics: { .. } /* static methods */ - displayName: '..' +```js +componentWillMount() +componentDidMount() - componentWillMount - componentWillUpdate - componentWillUnmount +// not on initial render +componentWillReceiveProps(props) +shouldComponentUpdate(props, state) +componentWillUpdate(props, state) +componentDidUpdate(prevProps, prevState) - componentDidMount - componentDidUpdate +componentWillUnmount() + +// ...there is no DidUnmount or ReceiveState. +``` ### Initial states