Browse Source

Clarify preferred "props default to true" expr (#495)

* Clarify preferred "props default to true" expr

The current text is ambiguous without reading further into the paragraph -- until I re-read this text, I was trying to avoid both types of syntax because it seemed to imply that it wans't recommended (eg "props default to true" --> "we don't recommend using this").

* Update jsx-in-depth.md

Co-authored-by: Sunil Pai <threepointone@oculus.com>
main
David Beitey 5 years ago
committed by GitHub
parent
commit
d1c1c30ea0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      content/docs/jsx-in-depth.md

2
content/docs/jsx-in-depth.md

@ -227,7 +227,7 @@ If you pass no value for a prop, it defaults to `true`. These two JSX expression
<MyTextBox autocomplete={true} />
```
In general, we don't recommend using this because it can be confused with the [ES6 object shorthand](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Object_initializer#New_notations_in_ECMAScript_2015) `{foo}` which is short for `{foo: foo}` rather than `{foo: true}`. This behavior is just there so that it matches the behavior of HTML.
In general, we don't recommend *not* passing a value for a prop, because it can be confused with the [ES6 object shorthand](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Object_initializer#New_notations_in_ECMAScript_2015) `{foo}` which is short for `{foo: foo}` rather than `{foo: true}`. This behavior is just there so that it matches the behavior of HTML.
### Spread Attributes {#spread-attributes}

Loading…
Cancel
Save