Skip to content

Commit 93bf976

Browse files
committed
Replace Crockford's advice with our own
1 parent 6846c10 commit 93bf976

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

react/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@
450450
```
451451
452452
- Do not use underscore prefix for internal methods of a React component.
453-
> 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.
453+
> 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.
454454
455455
```jsx
456456
// bad

0 commit comments

Comments
 (0)