Merge pull request #5790 from jimfb/componentWillReceiveProps-blogPost

Blog post explains to verify prop mutations in componentWillReceiveProps
(cherry picked from commit a1584053cc)
This commit is contained in:
Jim
2016-01-08 10:32:14 -08:00
committed by Paul O’Shannessy
parent d590910f6d
commit 4206fd1dce
2 changed files with 62 additions and 0 deletions
+2
View File
@@ -148,6 +148,8 @@ componentWillReceiveProps: function(nextProps) {
> Note:
>
> One common mistake is for code executed during this lifecycle method to assume that props have changed. To understand why this is invalid, read [A implies B does not imply B implies A](/react/blog/2016/01/08/A-implies-B-does-not-imply-B-implies-A.html)
>
> There is no analogous method `componentWillReceiveState`. An incoming prop transition may cause a state change, but the opposite is not true. If you need to perform operations in response to a state change, use `componentWillUpdate`.