-
Notifications
You must be signed in to change notification settings - Fork 0
Creating a React Application with Vite
React is a powerful JavaScript library for building modern front-end applications for the web. It is created and maintained by Meta (Facebook), and promotes a component-based architecture that "reacts" to changes in data, state, and user input.
- An new Github repository with only a README file (basic new repo process).
- A default Codespaces instance running on the repository above.
- A Netlify account.
- Create a new Codespaces instance on your newly-created Github repository.
- Launch your Codespaces instance in the browser or via dev containers on your local VS Code instance.
- When Codespaces is initialized, enter the following command into your Terminal prompt:
npm create vite@latest . -- --template reactUsing the dot operator above, we're telling the command that we want the output to go into the current directory. Because our current directory already has a README file, Vite is going to ask us what we want to do:

- Use your arrow keys to select "Ignore files and continue" and press Enter/Return. Vite will continue with the setup of the project.
- At this point, Vite should install the Node modules and start the server automatically (and you should be able to visit the dev site). If not, continue on to #4 and run
npm installmanually. - Install the required Node libraries (this will create the
node_modulesdirectory in your project):
npm install- Finally, start the Vite server and check that your React application is up and running:
npm run devIf everything goes right, your Codespaces project should look something like this:

There are no special steps for deploying a Vite/React site to Netlify. Create a new site from your Github repo (as we've been doing all semester) and Netlify will automatically recognize it as a React application.