Tech Interview RoomStudy guides

React Ecosystem

How do you set up a modern React project, and what does each common library do?

Beginner · 2 min read · Lesson 1 of 7 in React Ecosystem

Starting a project

  • Vite (npm create vite@latest my-app -- --template react-ts): fast dev server and build for single-page apps.
  • A framework when you need routing, server rendering and data loading out of the box: Next.js (App Router with Server Components), React Router v7 in framework mode (the successor of Remix), or TanStack Start. The React team recommends starting with a framework for new apps.
  • Create React App is deprecated; do not use it for new projects.

The usual library stack

  • Routing: React Router or TanStack Router (or the framework's router).
  • Server state / data fetching: TanStack Query or SWR (caching, refetching, mutations).
  • Client state: Zustand, Redux Toolkit or Jotai (when Context and useState are not enough).
  • Forms and validation: React Hook Form + Zod (or Valibot).
  • Styling: Tailwind CSS, CSS Modules, or CSS-in-JS with zero runtime (vanilla-extract, Panda); component libraries such as MUI, Chakra, Mantine, Ant Design, or shadcn/ui (copy-in components built on Radix primitives).
  • Testing: Vitest + React Testing Library; Playwright for end-to-end; MSW for API mocks; Storybook for components.
  • Quality: TypeScript, ESLint (with eslint-plugin-react-hooks), Prettier.

Example

bash
npm create vite@latest shop-ui -- --template react-ts
cd shop-ui
npm i react-router @tanstack/react-query zustand react-hook-form zod @hookform/resolvers
npm i -D vitest @testing-library/react @testing-library/user-event jsdom msw
npm run dev
tsx
// main.tsx
import { createRoot } from 'react-dom/client';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { BrowserRouter } from 'react-router';
import App from './App';

const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: 30_000 } } });

createRoot(document.getElementById('root')!).render(
  <QueryClientProvider client={queryClient}>
    <BrowserRouter>
      <App />
    </BrowserRouter>
  </QueryClientProvider>,
);

Follow-up questions interviewers ask

Try answering each one before you open it.

How do you choose between Vite + React Router and Next.js?

Use Vite with a client router for dashboards and internal tools behind login, where SEO and first-load speed matter less and static hosting is enough. Use Next.js (or React Router framework mode) for public sites that need SEO, server rendering, streaming and Server Components, or when you want backend endpoints in the same project.