You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 10, 2022. It is now read-only.
I recently ran into an issue in a project with @lamflam where we wanted to recalculate the initialState on withStateHandlers when the component receives new props. Here is the solution that we came up with, which makes use of getDerivedStateFromProps and the existing withStateHandlers utility:
We've read a few of the GitHub issues where it's been explained why this isn't a part of withStateHandlers or isn't its own recompose utility, but I thought I'd post it here and see if this solution is helpful to anyone else. Also more than happy to clean this up and turn it into a PR if it would make sense to include this with recompose.
The text was updated successfully, but these errors were encountered:
I recently ran into an issue in a project with @lamflam where we wanted to recalculate the
initialState
onwithStateHandlers
when the component receives new props. Here is the solution that we came up with, which makes use ofgetDerivedStateFromProps
and the existingwithStateHandlers
utility:We've read a few of the GitHub issues where it's been explained why this isn't a part of
withStateHandlers
or isn't its own recompose utility, but I thought I'd post it here and see if this solution is helpful to anyone else. Also more than happy to clean this up and turn it into a PR if it would make sense to include this with recompose.The text was updated successfully, but these errors were encountered: