Q. Which of these is a valid way to pass props to a component?

Code:
<MyComponent title="React" />
  • (A) title: 'React'
  • (B) MyComponent.props('React')
  • (C) <MyComponent title="React" />
  • (D) MyComponent[title='React']
πŸ’¬ Discuss
βœ… Correct Answer: (C) <MyComponent title="React" />
Explanation: Props are passed to components using JSX attributes like in HTML.
Explanation by: Mr. Dubey
Props are passed to components using JSX attributes like in HTML.

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
76
Total Visits
πŸ“½οΈ
1 y ago
Published
πŸŽ–οΈ
Mr. Dubey
Publisher
πŸ“ˆ
88%
Success Rate