Skip to content

Commit

Permalink
Explain why not to prefix methods with underscores
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmarek committed Aug 28, 2016
1 parent 1541503 commit 9b035cc
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,7 @@
```
- Do not use underscore prefix for internal methods of a React component.
> Why? Underscore prefixes are sometimes used as a convention in other languages to denote privacy. But, unlike those languages, there is no native support for privacy in JavaScript, everything is public. Regardless of your intentions, adding underscore prefixes to your properties does not actually make them private, and any property (underscore-prefixed or not) should be treated as being public. See issues #1024, and #490 for a more in-depth discussion.
```jsx
// bad
Expand Down

0 comments on commit 9b035cc

Please sign in to comment.