Deploy React JS App to GitHub Pages
If you have created a React app using VITE, Tailwind CSS, and a Custom Local Storage hook, and you now want to deploy it to GitHub Pages, follow the steps below:
Step 1: Build Your React App
First, build your React app using the following command:
npx vite build
Step 2: Install `gh-pages` Package
Install the `gh-pages` package by running the following command:
npm install gh-pages --save-dev
Step 3: Add Required Scripts to Package.json
Add the following scripts to your `package.json` file:
"scripts": {
"predeploy": "vite build",
"deploy": "gh-pages -d dist"
}
Step 4: Deploy Your App to GitHub Pages
Deploy your app to GitHub Pages by running the following command:
npm run deploy
Step 5: Access Your Deployed App
You can now access your deployed app by visiting the following URL:
https://.github.io//
Congratulations!
Your React app created using VITE, Tailwind CSS, and a Custom Local Storage hook has been successfully deployed to GitHub Pages.