JavaScript Frameworks
What JavaScript Frameworks Do for the Front End
JavaScript frameworks are libraries and toolkits that help developers build interactive user interfaces in the browser. Instead of manually updating each part of a page when data changes, the developer describes what the interface should look like for a given state, and the framework updates the page to match. They are built on JavaScript, the language of the browser, and are a specific kind of web framework.
The best-known examples are React, Vue and Angular. React is usually described as a library focused on building user interface components, and it is often combined with other packages for routing and data fetching. Vue is designed to be adopted gradually and includes official tools for routing and state management. Angular is a complete framework, with routing, forms and HTTP handling built in.
Components, State and Single-Page Apps
Most of these frameworks share three ideas. A component is a reusable piece of the interface, such as a navigation bar or a product card, with its own markup and logic. State is data that can change while the app runs, such as the contents of a shopping cart. When state changes, the affected components are redrawn.
Many framework apps are single-page applications (SPAs). The browser loads one HTML shell and a JavaScript bundle, and the script changes the displayed content as the visitor moves around the site. Data is requested from an API in the background instead of loading a complete new page each time. This makes the app feel responsive but places more work on the visitor's device.
How Framework Apps Are Built and Hosted
Framework code is usually written in JavaScript or TypeScript, often with a template syntax such as JSX or single-file components. Before deployment, a build tool compiles and bundles this code into standard files: HTML, CSS and JavaScript. These built files are static, so a basic web server or static hosting service can deliver them without a language runtime on the server.
The build step normally runs on the developer's computer or in a continuous integration pipeline, not on the visitor's device or the live server. This is why a client-side app can often be hosted without PHP or Node.js on the live server. Apps that render pages on the server need a running process, which is a different setup and is explained in server-side vs client-side rendering.
Frequently asked questions
Is React a framework or a library?
React is generally described as a library because it focuses on rendering user interfaces and leaves routing, data fetching and other tasks to separate packages. Many developers still call it a framework, and in practice React projects are often combined with a framework such as Next.js. The distinction is about scope rather than quality.
Do I need a JavaScript framework for a simple website?
Usually not. A brochure site with a few pages and a contact form can be built with plain HTML, CSS and a little JavaScript, which loads quickly and has fewer parts to maintain. A framework becomes useful when the interface is complex, has many interactive states or is worked on by a large team.