Learn how to build, test, deploy, and maintain robust software systems.
As a frontend grows, managing the DOM by hand becomes error-prone. You must remember to update the page everywhere a piece of data changes, and the code quickly becomes tangled. A frontend framework solves this by making the UI a function of your state: you describe what the interface should look like, and the framework updates the page when state changes. This lesson teaches the ideas that all modern frameworks share — components, props, state, declarative rendering, routing, and data fetching — using React and Vue concepts. The concepts transfer, even though the exact syntax differs between frameworks. By the end you will understand why frameworks exist and be able to think in components and state, which is the skill that matters most.
A component is a self-contained piece of UI with its own structure, styles, and behavior. Applications are built by composing many components together.
Components form a tree: a parent renders children, passing data down as props.
| Props | State | |
|---|---|---|
| What it is | Data passed from parent to child | Data a component manages itself |
| Mutability | Read-only from the child’s view | Mutable |
| Changes trigger | Parent re-renders | The component re-renders itself |
Imperative code says "find this element and change it." Declarative code says "the UI should look like this, given this state." Frameworks prefer the declarative style, so you describe the result and let the framework update the DOM.
React keeps a lightweight in-memory representation of the UI called the virtual DOM. When state changes, React compares the new virtual DOM with the old one and updates only the parts of the real DOM that changed. This is a React-specific optimisation, not a universal property of every framework, but the general idea — "recompute the result and update only what changed" — is common.
Framework events wrap the browser events you already know. Forms are usually "controlled": the input’s value is held in state, so the UI always reflects the data.
Single-page applications do not reload the page for each view. A client-side router maps the URL to a component, so navigating changes the visible component without a full page refresh.
Real applications show a loading indicator while fetching, an error message on failure, and an empty state when there is no data. Handling all three is part of building reliable interfaces.
| React | Vue | |
|---|---|---|
| Component style | JSX (functions) | Single-file components |
| Reactivity | State + re-render | Reactive refs |
| Learning curve | Moderate | Gentle |
| Common ground | Components, props, state, declarative UI | Components, props, state, declarative UI |
State (count) drives the UI. Clicking updates state, and the framework re-renders the button.
A parent passes data to a child as props.
Ada
A component handles all three fetch outcomes.
(loading, error, or the list depending on state)