Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Electron vs Web Apps (specifically, with React)

Context

I am currently developing a single page web application using React (and other node libraries). I am relatively deep into this project already. This application is being built to replace a company's logistics platform (transactions, inventory management, etc).

Their current system is a Windows based application, hence the gut feeling that an Electron desktop app might suite their needs more. I am developing a web based app as these are technologies I'm familiar with.

What I Know

Not a whole lot, hence the question. It is to my understanding that you are able to build essentially the same web app but wrapped with desktop capabilities using Electron. Additionally, Electron can work offline whereas a web app cannot.

What I've Researched

I've done some research but nothing quite hits the nail on the head for what I'm looking for. Others compare Electron with Extentions, Chrome Apps (depreciating), and PWA's. Noone seems to compare Electron with a Web App.

  • What is Electron, and Why Should We Use It
  • Chrome App vs Electron
  • PWA vs Electron vs Browser extension
  • From React to Electron

What I'd Like To Know

It's hard to say exactly, as this is fairly open ended question. None the less here are some points I'm struggling finding answer to:

  • Direct comparison of Single Page Web apps to Electron (security, benefits of native desktop features, deployment, etc.)
  • Ease of transitioning from pure Reactjs to Electron/Reactjs

All in all I was hoping someone would be able to point out anything that I'm missing that could potentially be a big factor in deciding on which path to take.

like image 769
Neil Avatar asked Apr 11 '19 18:04

Neil


People also ask

Can Electron be used with React?

Electron is a cross-platform desktop application framework. It is used to build desktop applications with the JavaScript language. It's definitely also possible to use JavaScript frameworks like React and Vue to build desktop applications with Electron.

How is Electron different from React?

Electron belongs to "Cross-Platform Desktop Development" category of the tech stack, while React Native can be primarily classified under "Cross-Platform Mobile Development". Some of the features offered by Electron are: Use HTML, CSS, and JavaScript with Chromium and Node. js to build your app.

Are Electron apps Web Apps?

While Electron, being a web application wrapped in a native app container, has to do everything manually by itself. Electron framework includes a number of APIs to help with the construction of desktop applications, and it can also leverage Node. js modules.

Is React only for web apps?

Previously written React code makes it seamless to build apps for both iOS as well as Android platforms at the same time. The code is utilized to build both Android and iOS native apps after it has been written since bridges are utilized to translate Javascript into native components.


1 Answers

I will try to give you a short answer to your questions:

What electron basicly does is bundle a browser engine (chromium in this case) with your app. The browser engine takes care of rendering your app.

The way to work with native features is to communicate between a main process and the renderer process. So basicly everything you want to do on the native desktop side is going to take place inside the main process. So in your case you would still need to do some extra work to make your web app work inside or with electron.

The benefits of native desktop features are depending of the use case of your web app. What i can tell from my own personal experience is that things like the following are very usefull:

  • access to the file system (write,read,edit,delete local files)
  • global shortcuts (for example pressing alt+o will open up your app or a specific page no matter what other application the user is using at the moment)
  • like you said if you have no internet connection your app will at least still render.

Deployment wise the most common thing would be to build and generate a installable .exe file of your app. There are a lot of librarys out there allowing you to build a .exe of your electron application for example "electron-builder". There are also many ways to deliver updates to your users with the build in electron updater api or some third party librarys.

Security wise i must admit im not so much into that part but the electron devs are keeping the framework uptodate very frequently so security issues should not be a problem.

Hope this answers at least some of your questions if not just ask more :)

like image 197
Nino9612 Avatar answered Sep 20 '22 21:09

Nino9612