Create a React Application
Now that we understand more about React and components, we are ready to build a React app. To make a new React application, we will be using a front-end tool called
. This will allow us to scaffold a new
React project with the required dependencies and launch a local dev server.
To get started we first need to install
vite within the project directory.
npm create vite@latest
You will be asked to provide a name for the project. The below example uses the name
You will then use your arrow keys to select the
You will then need to select the
Now that your project has scaffolded you can navigate into the project root directory and run the following commands:
npm run dev
This will start your local development server and you will see output similar to the below image:
You can view some useful Shortcuts if you press
At this point you can either open a web browser and navigate to
http://localhost:5173 or press
o if you are within the terminal window running the application.
You do not need to press
h in order for the shortcuts to work. Once the app is running you can press
o to view the application within the browser (if you are currently within the terminal window running the application).