Skip to main content
Frontend tutorial

3. Create base for your app

Let's start building a React app with Vite and pnpm. One pnpm create vite command gives you a handful of files and a demo page that we delete straight away. Before we build anything on top of it, let's see what those files do. A Vite project is easiest to read from the outside in:

  1. vite.config.ts: configuration for the frontend tool.
  2. index.html: the main HTML file, with the root div and the main script.
  3. src/main.tsx: creates the React app in the root div.
  4. src/App.tsx: the first component that we render.

Lessonsโ€‹

  1. Follow the page into App: in the browser. Read the entry files and clean up the template.
  2. Create your own project: on your computer. Create the app and meet the vite.config.ts we use at work.

03 / Create base for your app

Read the app from the outside in

Read the app from the outside inFour nested layers, numbered like the files on the page. 1, vite.config.ts: the configuration of Vite, the tool that serves the app. 2, index.html: the page with the root div and the main script. 3, src/main.tsx: creates the React app in the root div. 4, src/App.tsx: the first component, with a heading and a Count is 0 button.01vite.config.tsconfigures Vite, which serves it all02index.htmlthe page and its main script03src/main.tsxcreates React in the root div04src/App.tsxthe first componentCount is 0

Vite serves index.html, index.html loads main.tsx, and main.tsx renders App.