Skip to content

Update deprecated setProps syntax#11

Open
ChrisMLee wants to merge 1 commit intoghempton:masterfrom
ChrisMLee:setprops-deprecation-fix
Open

Update deprecated setProps syntax#11
ChrisMLee wants to merge 1 commit intoghempton:masterfrom
ChrisMLee:setprops-deprecation-fix

Conversation

@ChrisMLee
Copy link

As of React v15, the setProps function is deprecated and the current implementation causes errors when using React 15+. As an alternative, we can use state in place of props and provide an updateProps hook to update the props on the wrapped component (via state) programmatically as needed.

I'm aware that using props in getInitialState is normally considered an anti-pattern, but since all future updates to the component occur via the updateProps, I thought that it was an appropriate work around in this situation. Definitely interested in thoughts and feedback on the viability of this solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant