This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
first of all i created the react project with the help of vite
npm create vite@latest
then i removed unnecessary folders and the files after i mkdir pages & created the about, sgn in, sign put, projects, dashboard
then installed the required dependencies for react using npm
then i installed the react-router-dom
and i changed the app.jsx file like
<BrowserRouter>
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/signin" element={<SignIn />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/projects" element={<Projects />} />
</Routes>
</BrowserRouter>
then i created the components as mkdir components and in side of it Header component created
<BrowserRouter>
<Header />
<Routes>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/signin" element={<SignIn />} />
<Route path="/signup" element={<SignUp />} />
<Route path="/dashboard" element={<Dashboard />} />
<Route path="/projects" element={<Projects />} />
</Routes>
</BrowserRouter>
so i config that in to app.jsx
what is the benifits of using react-router-dom ?
1. It provides a way to navigate between different routes in an application, which allows users to start at the index.html file, and then move through all of the other components in the application without having to reload the page or make additional requests to the server.
2. It also allows for the creation of nested routes, which can be useful for organizing complex applications.
3. It also provides a way to pass data between different components in an application, which can be useful for sharing information between different parts of the application.
after it i used flowbite react https://www.flowbite-react.com/docs/getting-started/introduction package for responsive tailwind components
then config the flowbite package inside the tailwind css config
write the order what we are done p to now
- install node js
- install npm
- install react
- install react-router-dom
- install flowbite-react
- install tailwind css
- create page & router
- Header Component
- create & run the server
- connect db
- create user model
- create a test api routes
- create sign-up api route and pass the user data's via POST with the hash formate to env=crypt the password
- create middleware & a function to control the errors
- create sign-in & sign-up page
- create footer
- sign page set uped with the sign in and with the jwt
- global state management redux