Skip to content

Commit

Permalink
Replace Crockford's advice with our own
Browse files Browse the repository at this point in the history
  • Loading branch information
ttmarek committed Aug 27, 2016
1 parent 6846c10 commit 93bf976
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion react/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@
```
- Do not use underscore prefix for internal methods of a React component.
> Why? As Doug Crockford writes: "Do not use _ *underbar* as the first or last character of a name. It is sometimes intended to indicate privacy, but it does not actually provide privacy. If privacy is important, use closure. Avoid conventions that demonstrate a lack of competence." Source - http://javascript.crockford.com/code.html.
> 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 93bf976

Please sign in to comment.