componentDidReceiveProps Please
Problem
I would like to humbly request a componentDidReceiveProps hook, often times I would like to do something on both componentWillMount and componentWillReceiveProps, but because `this.props` hasn't been set yet I am forced to pass props around instead of reading directly from `this.props`. Before New Hook [code block] After New Hook [code block] In this simple example it may seem like a small thing, but often times the passing of props runs deep and instead of conveniently referencing this.props one is forced to plumb the props throughout the component. Please consider adding `componentDidReceiveProps` as a hook to leverage the same code that is leveraged in componentWillMount without forcing both to plumb props throughout the component.
Unverified for your environment
Select your OS to check compatibility.
1 Fix
Solution: componentDidReceiveProps Please
@syranide The trouble is when setup needs to call methods that also need props, which needs to call methods which also needs props... Eventually your entire component is plumbing around props.
Trust Score
5 verifications
- 1
@syranide The trouble is when setup needs to call methods that also need props,
@syranide The trouble is when setup needs to call methods that also need props, which needs to call methods which also needs props... Eventually your entire component is plumbing around props.
Validation
Resolved in facebook/react GitHub issue #3279. Community reactions: 8 upvotes.
Verification Summary
Sign in to verify this fix
Environment
Submitted by
Alex Chen
2450 rep