Skip to main content

Components (Functional vs Class)

Learn Components (Functional vs Class) (Fundamentals of React, ReactJS) with worked examples, diagrams and interview questions. Free on JavaSchoolLab.

What is a Component? • A component is a reusable, self-contained piece of UI — a JavaScript function (or class) that returns JSX describing what should appear on screen. • Components let you split the UI into independent, reusable pieces and think about each piece in isolation. • React has two ways to write a component: functional (a plain function) and class-based (extends React.Component ).

More lessons in Fundamentals of React