From 6377b2ed95fc30a185fcb45ba22832a45f1701c4 Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Wed, 2 Oct 2013 00:16:49 -0400 Subject: [PATCH] entry on willReceiveProps not triggered on mounting --- ...ceiveProps-not-triggered-after-mounting-tip.md | 10 ++++++++++ ...llReceiveProps-not-triggered-after-mounting.md | 15 +++++++++++++++ 2 files changed, 25 insertions(+) create mode 100644 docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting-tip.md create mode 100644 docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting.md diff --git a/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting-tip.md b/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting-tip.md new file mode 100644 index 0000000000..d40fc0df1a --- /dev/null +++ b/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting-tip.md @@ -0,0 +1,10 @@ +--- +id: componentWillReceiveProps-not-triggered-after-mounting-tip +title: componentWillReceiveProps not triggered after mounting +layout: docs +permalink: componentWillReceiveProps-not-triggered-after-mounting-tip.html +--- + +`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. + +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. diff --git a/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting.md b/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting.md new file mode 100644 index 0000000000..1b42a38d16 --- /dev/null +++ b/docs/cookbook/cb-09-componentWillReceiveProps-not-triggered-after-mounting.md @@ -0,0 +1,15 @@ +--- +id: componentWillReceiveProps-not-triggered-after-mounting +title: componentWillReceiveProps not triggered after mounting +layout: docs +permalink: componentWillReceiveProps-not-triggered-after-mounting.html +--- + +### Problem +`componentWillReceiveProps` isn't triggered after the node is put on scene. + +### Solution +This is by design. Checkout [other lifecycle methods](component-specs.html) for the one that suits your needs. + +### Discussion +`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.