React Components & JSX
Components are the core building block of React. A component is a piece of the UI (user interface) that has its own logic and appearance. Think of them like custom HTML elements.
Functional Components
In modern React, components are written as JavaScript functions. A functional component is simply a JavaScript function that returns React elements (JSX). To make it a valid component, the function name must start with a capital letter.
What is JSX?
JSX stands for JavaScript XML. It allows us to write HTML directly inside JavaScript. Under the hood, React transforms this JSX into standard JavaScript code that manipulates the DOM. Remember that you can only return one parent element from a component.
Nesting and Exporting
Components can be nested inside other components, exactly like HTML tags. To use a component created in one file inside another file, you use the ES6 Modules syntax: export default ComponentName; and then import it where needed.
View Full Transcript+
This section contains the full detailed transcript of the React Components Creation lesson. It deeply covers the shift from Class Components to Functional Components, the rules of JSX (camelCase attributes, closing all tags), and how React builds a Virtual DOM based on these component trees.
