React TutorialLesson 21Free preview
React Components
This lesson is part of React · All levels
Summary
The React component is a JavaScript function that returns JSX markup and can be reused in many places. You just write a function with a capital name and then call it an HTML element, like <Header />. Because they are a normal function, the components are easily tested and separated into separate files.
Key points
- The name of the component must be capitalized to distinguish it from the HTML element
- Components always return a root or fragment
- Components can be called repeatedly without duplicating the code
- One file should contain one main component with default export
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.