Electron with/without React or Angular


#1

Beginning Electron developer but long experience with native and web apps.

My question is when building an Electron app what is the best practices to include or not include additional frameworks like React or Angular.

I noticed in my reading that so many of the articles do have React or Angular as part of their development set. Is that because they came from that environment for web/phone development? What advantages does combining another framework to an Electron app.

In my first app that I’ve developing it will always be an app that is bound to some hardware and not a phone or web/server app.I’m using Sqlite as the data store and will in all likelihood not use any / few native calls. Data will be locally input with output either on screen or printer/pdf.

I realize that Electron is still is an emerging technology but I can find very few best practices documents and architecture discussions only some very narrow focused samples.


#2

There’s not much call for best practices for Electron specifically aside from what you normally do with a Node-based application running in Chrome (since that’s literally all an Electron app is). The main architectural practices you need to think about with Electron have to do with separating tasks into main and renderer processes (the main process governs launching your app and is required for some actions, where the renderer process can be thought of as a single tab/window and is the app itself) and packaging (you typically don’t want to ship a folder of raw JavaScript files, because that’s vulnerable to being changed by an unwitting user). Since you’re using a database, you won’t need to think about storing much on the user’s computer.

Many people use React and Angular to design Electron apps because it’s much easier to build a single-page application with a framework than with raw DOM manipulation.