Latest solutions
Latest comments
- @dothenghiaSubmitted about 2 years ago@HsienzPosted about 2 years ago
Hello, I also use Vite to create my react project. You can try to deploy your app on github by add base in your vite.config.js, which you have done it.
Then, install gh-pages by
npm i gh-pages
And then, add these two scripts to your package.json's "scripts" object:
"predeploy": "npm run build", "deploy": "gh-pages -d dist"
so your package.json may look like
... "type": "module", "scripts": { "dev": "vite", "build": "vite build", "preview": "vite preview", "predeploy": "npm run build", "deploy": "gh-pages -d dist" }, "dependencies": { ...
then you can simply run
npm run deploy
to deploy your web to github
Because I am also a beginner, I am not sure the answer of the second question. But I also pass useState to child. So I think it is ok to use.
Hope those would help you.
Marked as helpful0