Why would I ever use state parameter in getter function instead of this.myState
?
#1980
Unanswered
katerlouis
asked this question in
Help and Questions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
In getters I find myself constantly going back to alter parameter destructuring; explicitly grabbing the state I need is cumbersome and often takes me out of the thought flow. Of course I could just not destructure and use
state
as param, but why not just usethis
throughout then? Due to syntax highlighting its more clear at a glance (to me) I'm dealing with a store-related variable; the mix up can be confusing andstate
has one letter more thanthis
:D:DSeriously though: I definitely prefer using the only-
this
approach; Am I missing a con here?Beta Was this translation helpful? Give feedback.
All reactions