Migrate string-refs to functional ones: this.refs.dotMenu #15845
Labels
Area/Technical Debt
Difficulty/1:Easy
Easy ticket
Hacktoberfest
Help Wanted
Community help wanted
PR Exists
Context:
String references are deprecated in React, and they will eventually disappear. Since React 16.3 there is the new api to use for reference creation
createRef
which improved the way to handle them greatly. Callbacks refs still have some valid usage, so we might make exceptions with those, please raise the issue if you feel you need to use them.How to migrate
Go to ./components/rhsroot_post/rhs_rootpost.jsx and look for usage of this.refs.dotMenu. Once you find them:
this.refs.some-reference
this.some-reference = React.createRef()
this.refs.some-reference
into usingthis.some-reference.current
. Be aware that this might be accessed by files other than the one that defined it. Also, you might need to refactor the code to keep behaviour the same.this.refs
used in the file and repeat from the begining.Example of migrated code
Questions
you can ask for help messaging @guillermo.vaya or posting in the ~webapp channel in the community server
If you're interested please comment here and come join our "Contributors" community channel on our daily build server, where you can discuss questions with community members and the Mattermost core team. For technical advice or questions, please join our "Developers" community channel.
New contributors please see our Developer's Guide.
JIRA ticket: https://mattermost.atlassian.net/browse/MM-29406
The text was updated successfully, but these errors were encountered: