mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-27 03:08:06 +00:00
entry on willReceiveProps not triggered on mounting
This commit is contained in:
committed by
Connor McSheffrey
parent
6b0353ddc9
commit
0dc3944e22
@@ -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.
|
||||
@@ -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.
|
||||
Reference in New Issue
Block a user