Choosing a React framework

Intermediate · 14 min

A comparative survey of Vite SPAs, Next.js, and React Router's framework mode, and the real factors that should drive the choice.

Before thisServer Components vs. Client ComponentsReact Router fundamentals

Theo - t3.gg · 14 min

Choosing a React framework

The player loads from youtube-nocookie.com when you press play. Nothing reaches YouTube before that.

Taught by Theo - t3.ggReport a problem with this video
Not started
Set this lesson's status

What you'll learn

  • A plain Vite + React SPA gives you the fewest conventions and the most control, at the cost of building routing, data-fetching, and SSR yourself if you ever need them.
  • Next.js bakes in file-based routing, server rendering, and React Server Components as the default architecture, which is powerful but means accepting its conventions and its deployment assumptions.
  • React Router's framework mode (formerly the separate Remix) sits between the two: real routing and data-loading conventions, SSR if you want it, without going as far into Next.js's own server-component-first architecture.
  • The decision should be driven by concrete factors: does the app need SEO or fast first paint from SSR, where will it be hosted, how much does the team already know one tool, and how much do you want the framework deciding your routing and data-fetching conventions versus deciding that yourself.
  • A project that is purely an internal dashboard or authenticated app behind a login screen usually has no SEO need at all, which removes the single biggest reason to reach for server rendering.
  • None of these choices is permanent or free to reverse, so picking based on today's actual constraints beats picking based on which framework is trending.

This is a decision, not a tutorial

Every lesson before this one taught you a piece of React itself. This one is different: it’s a survey of the real options for how you assemble a React app in practice, and the factors that should decide between them. None of the options below gets a deep tutorial here — each deserves (and often has) its own documentation, and some get their own Upshard roadmap.

The options

A plain Vite + React SPA. You bring your own router (React Router, in library mode), your own data-fetching (TanStack Query, or plain fetch in effects), and there’s no built-in SSR. This is the setup most of this roadmap has been implicitly assuming. It gives you maximum control and the fewest surprises, at the cost of wiring up anything beyond rendering yourself, including SSR if you ever decide you need it later.

# A Vite SPA's own conventions, in full:
src/main.tsx   -> createRoot(...).render(<App />)
src/App.tsx    -> you bring your own router, your own data layer

Next.js. The App Router makes file-based routing and React Server Components the default: a file under app/dashboard/page.tsx is the /dashboard route, components render on the server unless marked "use client", and server rendering, streaming, and bundling are all handled by the framework’s own conventions.

app/
  layout.tsx      -> shared shell, rendered on the server
  page.tsx        -> the "/" route
  dashboard/
    page.tsx      -> the "/dashboard" route, a Server Component by default

This buys you a lot — SSR, streaming, image and font optimization, a large ecosystem — but it also means accepting Next.js’s own architectural opinions about where code runs, and it’s most at home deployed to a host built around its server runtime (Vercel being the obvious one, though self-hosting works too).

React Router in framework mode. Since React Router absorbed Remix, its “framework mode” gives you file-based or config-based routing, per-route data loaders and actions, and optional SSR, while staying closer to “React Router with more conventions” than to Next.js’s server-component-first model.

// app/routes/dashboard.tsx — a route with its own data loader
export async function loader() {
  return fetch("/api/dashboard-data").then((r) => r.json());
}

export default function Dashboard() {
  const data = useLoaderData();
  return <div>{/* ... */}</div>;
}

This is a middle path: real routing and data conventions without fully adopting Server Components as the default rendering model.

Others exist. TanStack Start and Astro-with-React-islands are worth knowing about if the specific constraints call for them (type-safe routing in the first case, a mostly-static content site with islands of interactivity in the second), but the three above cover the large majority of real decisions.

The factors that actually matter

  • SEO and first-paint needs. A public, search-indexed site benefits concretely from SSR. A dashboard behind a login screen gets nothing from it — there’s no crawler to serve, and the user already waited through a loading screen to log in.
  • Deployment target. Some hosts are built around a specific framework’s server runtime; deploying Next.js’s server features to a plain static host, or deploying a framework-agnostic SPA to a platform tuned for one framework, both create friction that’s worth checking before you commit.
  • Team familiarity. A team fluent in plain React + Vite will ship faster in that setup than in an unfamiliar framework, even one that’s theoretically a better technical fit. Familiarity is a real cost, not a soft excuse.
  • How much you want the framework deciding for you. Next.js and React Router’s framework mode both impose real conventions — file-based routes, specific data-loading patterns — in exchange for not having to invent those conventions yourself. A plain SPA hands you that decision back, for better or worse depending on how much you value the structure.

None of these are abstract. A team building an internal admin tool with no SEO need, already comfortable with Vite, deploying to a generic static host, has a straightforward case for staying with a plain SPA. A team building a public marketing-and-app hybrid site, deploying to a host that’s optimized for it, has a straightforward case for Next.js. Most real decisions look like one of these two shapes once the factors are actually named.

What the video covers

Theo’s “JavaScript Frameworks in 2023” is explicitly a decision framework rather than a tutorial: classify the project (a mostly-static site versus an interactive app) first, then pick the most minimal tool that satisfies it. Being from January 2023, it predates React Router’s framework mode and the current state of the Next.js App Router, so treat its specific product recommendations as dated while its reasoning approach still holds; the two links below update the specifics into the current, post-Remix-merger landscape.

Where this fits

This is the final lesson of the React roadmap. It leans on the server-rendering concepts from the server-side-react group and the routing concepts from the routing group — if either is fuzzy, server components vs. client components and React Router fundamentals are the lessons to revisit. Whichever framework the factors above point you toward, going deep on it is a job for that framework’s own roadmap — Next.js gets one of its own elsewhere on Upshard — rather than for this one, which has stayed deliberately at what React itself provides.

Check yourself

  1. 01Why would a marketing site benefit from SSR in a way an internal, logged-in dashboard typically would not?

    A marketing site needs to be indexed and ranked by search engines and to render content fast for a first-time visitor who hasn't loaded any JavaScript yet, both of which server rendering helps with, while an internal dashboard is only ever used by already-authenticated users who don't need SEO and already accept a loading state before their own data is personalized to them.

  2. 02What is the main architectural difference between a plain Vite SPA and Next.js's App Router?

    A Vite SPA ships a single client-rendered app with routing and data-fetching left entirely to whatever libraries you choose to add, while Next.js's App Router makes file-based routing and React Server Components the default architecture, rendering on the server by default and only sending client-side JavaScript for components explicitly marked as client components.

  3. 03Where does React Router's framework mode sit relative to a plain SPA and Next.js, in terms of how many conventions it imposes?

    It sits in between: it provides real routing and data-loading conventions (loaders, actions, nested routes) and can render on the server, similar in spirit to what Remix offered before merging into React Router, without going as far as Next.js's server-component-first rendering model.

  4. 04Besides SEO and SSR needs, what are two other factors that should influence which React framework or setup a team picks?

    Deployment target or hosting constraints (some hosts are tuned specifically for one framework's server runtime) and team familiarity (a team that already knows one tool well will ship faster in it than in an unfamiliar one, even if the unfamiliar one is theoretically a better fit) are both legitimate deciding factors alongside the purely technical ones.

Go deeper

Notes

Private to you

Esc
↑↓ navigate↵ open? shortcuts

Keyboard shortcuts

Press Esc to close

Anywhere

⌘K
Search and commands
/
Search
?
This sheet
Esc
Close

Reading a lesson

J
Next lesson
K
Previous lesson
B
Bookmark