-
-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecated UNSAFE_componentWillReceiveProps #380
Comments
Well, so far I haven't found a better alternative. |
Here's some brief explanation: This is normal. I am aware of this issue. The code works though. The problem is that we need to dispatch an action during the render.
Mention @SergiiBurgazlieiev @kamleshkatpara #387 |
Thank you !
On Thu, Jun 17, 2021 at 2:32 PM Kirill Konshin ***@***.***> wrote:
Here's some brief explanation:
This is normal. I am aware of this issue. The code works though.
The problem is that we need to dispatch an action during the render.
componentWillReceiveProps does exactly that.
getDerivedStateFromProps does not have access to instance fields, where
the store resides. Potentially we can put the store in the state instead,
so that GDSFP function will have access to it. Feel free to submit a pull
request.
Mention @SergiiBurgazlieiev <https://github.com/SergiiBurgazlieiev>
@kamleshkatpara <https://github.com/kamleshkatpara> #387
<#387>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#380 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALIIQOMGBFSNOE5UM6AOEFLTTJEUJANCNFSM46JSUEWA>
.
--
Kind Regards,
Sergii Burgazlieiev
|
А что мне делать с этой ошибкой на проде? |
Nothing. It is working. It is surely annoying but it does not affect anything. The fix is on the way. |
I'm getting the same error. Is there an update for this fix? |
i hope getting update sooner |
@kirill-konshin What about using |
It won't help because we need to dispatch hydration action after we received props but before render. |
…E_componentWillReceiveProps`
@kirill-konshin please take a look at my PR. Perhaps this is what we need. #413 |
Oh so getSnapshotBeforeUpdate will not be able to hydrate the state before react commits to the DOM? Also, getSnapshotBeforeUpdate does have access to context if that helps |
Good job @fostyfost! Looks like tests are passing, can you please manually verify that things still work and there are no warnings in console. Once you confirm, I will merge and do my part of regression testing and then I'll release. @alguerocode @adrenaline681 @Giridhar108 @SergiiBurgazlieiev @cibulka you guys are most welcome to help to verify if fix works. |
Released 7.0.4 |
FYI I've created a new PR to get rid of old class-based component in favor of hook: #419 |
Hi, thanks for a very helpful library!
I've turned "React Strict mode" today and was greeted with following warning: "Warning: Using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs in your code. See https://reactjs.org/link/unsafe-component-lifecycles for details."
This hook is used in the wrapper function of your library and judging by your comment -
If someone knows a better way to replace this with sync hook that can dispatch before render let me know
- you probably already know that this method will be deprecated.Just wanted to ask what are your plans with this then? Thanks again, P!
The text was updated successfully, but these errors were encountered: