Guide: How convert to a React App #770
Replies: 6 comments 4 replies
-
thank you for this 🤝 |
Beta Was this translation helpful? Give feedback.
-
I followed all the steps suggested. The app shows up, but some strange error messages appear :
You can find the repo here: https://github.com/raphael10-collab/ViteElectronReactBuilder |
Beta Was this translation helpful? Give feedback.
-
Thank you very much!!! |
Beta Was this translation helpful? Give feedback.
-
@ClemensDinkel great doc! |
Beta Was this translation helpful? Give feedback.
-
I had to Thank you so much for the conversion! This plus the template by cawa-93 have helped me so much! |
Beta Was this translation helpful? Give feedback.
-
Now you can run |
Beta Was this translation helpful? Give feedback.
-
There are quite a few react forks of this template out there, but since this template is maintained regularly they're not necessarily up to date. That's why I gave it try myself and was surprised that it's actually not that hard.
So if you want to use the latest version of this template, but use React instead of Vue, here's a quick guide on how to convert this to React which I created while doing it myself:
npm uninstall vue @vitejs/plugin-vue @vue/test-utils vue-tsc
npm install react react-dom
npm install -D @types/react @types/react-dom
packages/renderer
index.html
change the src attribute of the script tag to"./src/index.tsx"
src
packages/renderer/tsconfig.json
(not the one in the root folder!)vite.config.js
replace the vue plugin with the react plugin :import react from '@vitejs/plugin-react';
vue()
withreact()
APP.vue
and all the Vue componentsextends
property in packages/renderer.eslintrc.jsonApp.tsx
and import it inindex.tsx
package.json
and replacevue-tsc
bytsc
in thetypescript:renderer
scriptVUEJS3_DEVTOOLS
in all places byREACT_DEVELOPER_TOOLS
vite-plugin-svgr
and follow the instructions at https://www.npmjs.com/package/vite-plugin-svgrhappy hacking :)
Proper cleanup
Vue still is still buried in a lot of places. Your app should run nevertheless. If you want to do a proper cleanup simply search for vue and remove/replace every mention as you see fit.
If you think something should be handled differently or something is missing, drop a comment. I'll update this post.
Beta Was this translation helpful? Give feedback.
All reactions