Browser and React foundations
Syllabus
Detailed content
How the browser renders a page
The browser parses HTML into a document tree, applies CSS rules, calculates layout, and paints pixels. JavaScript can update the document and respond to user events. Large scripts and expensive rendering block interaction. Understanding this path helps explain why semantic HTML, small updates, and responsive CSS improve both usability and performance.
JSX and component structure
JSX is syntax for describing a UI tree with JavaScript expressions. A React component is a function that returns that description. Split the page into components when they have a clear responsibility, useful reuse, or independent behavior. Keep markup readable and use semantic elements such as buttons, headings, forms, and navigation.
Props and one-way data flow
Props are inputs passed from a parent component to a child. Data flows downward, while callbacks let a child request that a parent update state. This makes ownership visible: the component that needs to coordinate a value should own it. Avoid copying props into state unless the component intentionally manages an editable draft.