Vite React
Basic Setup
(yarn or npm interchangeable)
- Ensure you are using node:
nvm use lts/iron - Vite as the HMR dev server
yarn create vite <app-name> --template react-ts- React as the FE framework
- TS for type checking
- ESLinters for ensuring format and structure
yarn add eslint eslint-plugin-react --save-devgit init-> vite already created a nice .gitignore for usyarn add @reduxjs/toolkit-> redux for jsyarn add react-redux-> redux for reactyarn add react-router-dom-> browserRouteryarn add axios-> data util that handles the api calls
Using MUI components system
MUI adds
yarn add @mui/joy @emotion/react @emotion/styled-> new MUI library for componentsyarn add @fontsource/roboto-> MUI’s preferred fontyarn add @mui/icons-materialJOY addsyarn add @fontsource/inter-> Joy’s preferred font, usageimport '@fontsource/inter';
CSS regular
yarn add sass
Routes File
/src/routes/routes.tsx
import {
createBrowserRouter,
} from "react-router-dom";
export const router = createBrowserRouter([
{
path: "/",
element: <RootPage />,
errorElement: <ErrorPage />,
},
{...},
])