⊗jsrxPmTlsIR 7 of 57 menu

Installing and Preparing a React Application

In this lesson we'll start by setting up and preparing a React app, as we'll be using it with Redux later on. There are quicker (which doesn't always mean easy, especially for beginners) ways to create a React app template with Redux, which are listed in the official documentation, but we'll start from scratch.

To begin, let's create a React app my-app using Vite (a trendy replacement for Webpack). To do this, open terminal and enter the following commands (from the options offered, if any, select React and then JavaScript):

npm create vite@latest my-app --template react cd my-app npm install

Let's run the created application:

npm run dev

Let's open the suggested link http://localhost:5173/ in the browser and see the familiar splash screen. Everything works.

Now let's remove the unnecessary stuff. Let's clean out the public folder. In the src folder, let's leave only main.jsx, index.css and App.jsx (let's completely delete the contents of index.css and App.jsx).

In the file index.html we will replace the title text with:

<title>React Redux App</title>

Build a React application and make sure it works.

Delete unnecessary files and folders.

enru