entry on willReceiveProps not triggered on mounting
Cheng Lou committed
Oct 2, 2013 at 00:16 UTC
6377b2ed95fc30a185fcb45ba22832a45f1701c4
2 files changed
+25
docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting-tip.md
new
+10
@@ -0,0 +1,10 @@
1
+---
2
+id: componentWillReceiveProps-not-triggered-after-mounting-tip
3
+title: componentWillReceiveProps not triggered after mounting
4
+layout: docs
5
+permalink: componentWillReceiveProps-not-triggered-after-mounting-tip.html
6
+---
7
+
8
+`componentWillReceiveProps` isn't triggered after the node is put on scene. This is by design. Checkout [other lifecycle methods](component-specs.html) for the one that suits your needs.
9
+
10
+The reason for that is because `componentWillReceiveProps` often handles the logic of comparing with the old props and act upon changes; not triggering it at mounting, where there are no old props, clearly defines what the method should do.
docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting.md
new
+15
@@ -0,0 +1,15 @@
1
+---
2
+id: componentWillReceiveProps-not-triggered-after-mounting
3
+title: componentWillReceiveProps not triggered after mounting
4
+layout: docs
5
+permalink: componentWillReceiveProps-not-triggered-after-mounting.html
6
+---
7
+
8
+### Problem
9
+`componentWillReceiveProps` isn't triggered after the node is put on scene.
10
+
11
+### Solution
12
+This is by design. Checkout [other lifecycle methods](component-specs.html) for the one that suits your needs.
13
+
14
+### Discussion
15
+`componentWillReceiveProps` often handles the logic of comparing with the old props and act upon changes; not triggering it at mounting, where there are no old props, clearly defines what the method should do.