Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
74
rated 0 times [  79] [ 5]  / answers: 1 / hits: 52677  / 7 Years ago, sat, june 24, 2017, 12:00:00

I'm doing a redux tutorial, and I saw a call like this:



this._render();


and it's defined elsewhere as:



_render() {
....
}


What is the underscore _? Why is it used?


More From » reactjs

 Answers
23

This is convention of private methods and variables. In JavaScript there is no real privacy of classes.



It means that you should not use these method (starting with _) out of your object. Of course technically you can, but _ means that you should not.


[#57319] Thursday, June 22, 2017, 7 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jarod

Total Points: 62
Total Questions: 111
Total Answers: 83

Location: Saint Vincent and the Grenadines
Member since Sat, Sep 11, 2021
3 Years ago
jarod questions
;