Vite js is a next-generation front-end build tool that is designed to optimize your development experience and improve your build performance. With its support for React js and Bootstrap, you can quickly create modern web applications with ease. In this tutorial, we will walk you through the process of getting started with Vite js, React js, and Bootstrap.
Step 1: Setup a new Vite js project
To get started, you need to have Node.js installed on your machine. If you don’t have it installed, you can download it from the official Node.js website. Once you have Node.js installed, you can create a new Vite js project by running the following commands in your terminal:
npm init @vitejs/app my-vite-react-app --template react
cd my-vite-react-app
npm install
This will create a new Vite js project with React js template. Next, you need to install Bootstrap in your project. You can do this by running the following command in your terminal:
npm install bootstrap@5.1.1
Step 2: Import Bootstrap styles in your project
To use Bootstrap in your React js project, you need to import its styles in your project. You can do this by adding the following import statement at the top of your index.css
file:
@import "~bootstrap/dist/css/bootstrap.min.css";
Step 3: Create a new React component
Now that you have set up your project, you can create a new React component. You can do this by creating a new file in the src
folder called App.jsx
and adding the following code:
import React from 'react';
const App = () => {
return (
<div className="container">
<h1>Hello, world!</h1>
</div>
);
};
export default App;
Step 4: Render the React component
Next, you need to render the App
component in the src/main.js
file. You can do this by importing the App
component and using the ReactDOM.render
method to render it in the root element of your HTML file:
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App />, document.getElementById('root'));
Step 5: Start the development server
To start the development server and see your application in action, you can run the following command in your terminal:
npm run dev
This will start the development server at http://localhost:3000
, and you should see your React application with Bootstrap styles applied.
Congratulations! You have successfully set up a new Vite js project with React js and Bootstrap. You can now start building your web application by creating new React components and adding Bootstrap styles to them. Happy coding!
very nice video, thanks for sharing!
super
Perfect !!
why you change ma-auto to ms-auto how to know that
hey, would you tell me how to auto import like you when you code <Header /> it's auto import at top
I recently learned Bootstrap and React, so this was perfect. Thank you!
why don't you use latest boostrap
why u dont make another page for about?
100th sub here.
Thanks!!!
thankssss my bro ❤.
i am from Indonesia.
I love this video.
Godbless
hello sir , can you make video about vite app deployment into github page ..
Excelente muy bueno.
Amazing video
Thanks for sharing with us. This whole project uses such marvelous packages which is best for frontend and backend. It helped me a lot.
Many thanks! Official bootstrap page for vite integration was even wrong
even though an explanation would be better, this really helps me starting my project. Thanks!
the screen is to small maybe you can increase the font size😢
How localhost u have visible without put npm run dev in terminal? i need to see
Nice man! why you use the version 4.6 boostrap??