InterviewHubPRO
Section Overview
Q182

Question 182 of 445

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

41%
React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

When component props defaults to true?

If you pass no value for a prop, it defaults to true. This behavior is available so that it matches the behavior of HTML.

For example, below expressions are equivalent,

javascript
<MyInput autocomplete />

<MyInput autocomplete={true} />

Note: It is not recommended to use this approach because it can be confused with the ES6 object shorthand (example, {name} which is short for {name: name})