Is React a Framework or a Library

Is React a framework or library? React is a library for building user interfaces. It lets you split a screen into components and describe what each one shows as data changes. A React framework handles choices that affect the whole application, such as how a URL resolves to a page and how that page is rendered. Both layers can be present in a single project. Learning where each one fits helps you tell whether a change belongs in a component, the router, or the server.

A game directory offers a small example of how the two layers fit together. In a prototype for an online casino such as slot raze, React can update the selected category and the cards on screen. If visitors bookmark a game page, the application’s routing setup needs to resolve that URL on a later visit.

What React handles in the interface

A component describes a piece of the interface. A result card can receive a title and a URL through props. The parent component can remember the selected category in state and use it to decide which cards to display. When a visitor picks a category, the state update prompts React to render the affected part of the component tree. React DOM then updates the browser document where needed.

Read a filterable results page from the user’s click back to the data on screen. Four React concepts explain what happens along the way.

React concepts in a filterable results page
ConceptExampleRole
ComponentA result cardDescribes a reusable part of the interface
PropsA card’s title and URLPass inputs from a parent to a child
StateThe currently selected categoryTracks a value that can change over time
Event handlerA callback for selecting a categoryResponds to an interaction and updates state

Check the inputs before changing the component. If a card shows the wrong title, see what its parent passed in. If tapping a filter has no effect, trace the event handler and the state it updates.

A component describes the interface for the props and state it receives on that render.

Carved wooden panels beside a frame made from matching pieces

What a React framework adds

What is a React framework? It uses React for the interface and supplies a structure for the application around it. Depending on the framework, that structure can cover route definitions, data loading, asset handling, and rendering. Some tools are also available as separate libraries. For example, a project can use a router with React and choose its own build setup. Next.js, for instance, supplies an App Router with conventions for files that define pages and layouts. Teams can compare those conventions with the routing and deployment choices their project already makes.

A direct visit to an article shows where a framework can help. If the app renders on the server and then adds React interactivity in the browser, a request can follow this sequence.

  1. Match the URL to a route.
  2. Load the article data for that route.
  3. Render the initial HTML on the server.
  4. Send the HTML and tell the browser which assets to load.
  5. Hydrate the rendered pages when they need React interactivity.

React provides APIs for rendering HTML and for attaching to HTML that already exists in the browser. The second operation is called hydration. The framework can decide when to call those APIs and which code the browser needs for the page. For an article preview with a save button, hydration lets React attach the behavior for that button to the HTML the server sent.

Trace a single page from its URL to its initial HTML to see where the framework fits.

How Ultra uses React with Deno

In Ultra, Deno runs the server code and React supplies the components. Ultra’s docs describe how the project uses ES modules and import maps and supports server-side rendering with React Suspense. A component still reads props and manages state the way it would in another React setup. Ultra supplies the surrounding structure for sending the rendered application to a browser.

The Knowledge Base shows how names such as react are resolved through an import map. The Fly.io / Docker guide shows where a build step fits before the app starts in Deno. Together, those pages illustrate the different roles in the stack.

Responsibilities in the Ultra stack
LayerWhat it contributesWhere to look
ReactComponents, state, and rendering APIsComponent definitions and hooks
UltraApplication setup for React server renderingServer and browser entry points
DenoRuntime for the server code and toolingProject tasks and deployment configuration
Import mapsMappings from module specifiers to their locationsDependency mappings used by the project

The role of each layer gives you a starting point when a page breaks. Inspect the props if a heading displays the wrong text. Check the router or server configuration if an article fails only when a visitor opens its URL directly. Review the import map if an import cannot be resolved.

When to add React or start with a framework

An existing website may already know how to serve every page. Adding a React search filter can leave the rest of that setup in place. A new app with many pages has more decisions to make up front. A framework can supply shared rules for serving those URLs and preparing the content for each one.

Use the project’s requirements to decide how much structure to take on. Answer these questions before picking an approach.

  • Does the project already have a router and a build process?
  • Which URLs must work when users open them directly?
  • Where does each page obtain its initial data?
  • Which pages need HTML before any client code runs?
  • Can the chosen setup deploy to the runtime the team uses?

Start with one page or feature and follow it from the URL to the component. If the rest of the site already handles routing, data loading, and deployment, you can add React where you need interactivity. If the project needs conventions for those parts, compare frameworks by how they render the pages and where they run. The choice should follow the shape of the application.