React is a JavaScript library that enables the creation of functions responsible for generating HTML content. These functions encapsulate specific pieces of user interface, and they are designed to be reusable across different parts of a web application. Once defined, these functions can be exported and utilized throughout the application, making it efficient and modular in structuring the visual elements of a website.React Basics:
In the foundational version of React, there’s a script that simplifies the process of integrating your JavaScript components directly into your HTML pages. This is helpful because it keeps your code organized and reusable. React has a convention where the names of your functions and components should start with a capital letter. This convention makes it easier to distinguish between regular HTML elements and your custom React components. To start your React application, you use the command npm run start. This script sets up a development server and allows you to see your React app in action.
Vite React:
Now, in Vite React, things are a bit different. Instead of having a script that automatically handles the integration of your JavaScript into HTML, you need to do it manually. You still follow the convention of starting the names of your functions and components with a capital letter. However, Vite React doesn’t provide a specific script for directly adding JavaScript to HTML pages.
When you’re working with Vite React, you manually incorporate your JavaScript functions and components into your project. This gives you more control over the structure of your code but requires a bit more effort compared to the streamlined process in basic React.
To run your Vite React application and see the changes you’ve made, you use the command npm run dev. This command initiates a development server, similar to React basics, but the setup and handling of JavaScript and HTML integration are more manual in Vite React.
In summary, React provides a simpler setup with a script that automates certain tasks, while Vite React gives you more flexibility but requires a bit more manual configuration. The choice between the two depends on your preference and the specific needs of your project.
Source: hashnode.com