Why Everyone Hates Electron.js and Why I Love It

·

6 min read

ElectronJS

Even if you are not a web developer, you have most likely heard of electron. If you haven't, heres the description from the website:

Electron is a framework that enables you to create desktop applications with JavaScript, HTML, and CSS. These applications can then be packaged to run directly on macOS, Windows, or Linux, or distributed via the Mac App Store or the Microsoft Store.

Typically, you create a desktop application for an operating system (OS) using each operating system's specific native application frameworks. Electron makes it possible to write your application once using technologies that you already know. I find this very useful, but why do people hate it so much?

chromium

That's why. Electron uses the Chromium engine to render the apps as if they were running in a browser. This means "high" RAM and CPU usage. Anyone who is reading this that knows me knows that I use a Chromebook with custom firmware and arch linux as my main device. I am able to run 3 electron apps plus my browser at once, all at 90% CPU and a bunch of RAM left over out of my 4gb. However, some of the big apps are built or have been previously built with electron (slack, vscode, Skype, Discord, etc.).

Whilst it can slow a machine down, it also has many advantages, such as shared code base between platforms, lower learning curve etc.

Then there are memory leaks. Thats probably a reason why its hated. JavaScript is insanely prone to memory leaks, and the workarounds are very complex involving ridiculous convoluted closure tricks and things like that.

Now, I have just gone through reasons why people don't like it. There are so many ways it is amazing though.

You would be happy to know that Electron.js is such a framework in which you would not have to do any special preparation for letting your desktop application work on various platforms. As it offers pre-compiled code for several different platforms. This is also one of those reasons, which made Electron.js the best framework to build cross-platform desktop applications.

While using Electron.js, you would be working with HTML5, CSS, and JavaScript. Moreover, it is an open-source project, with which you must have come to know that Electron.js would have a highly supportive and large community who will be there to enhance this framework and help you in any problem during app development.

Personally I like how Electron.js uses Chromium as an engine. It is such an extensive engine with the help of which you would be able to take advantage of several heavy processes. It is also said that the chromium system engine is as big as an operating system, which is the reason behind its number of feature support. You would also be able to access several numbers of development tools (Chrome devtools), which will make your development processes more accessible than ever.

The main reason which makes Electron.js so different from other such platforms, is that you would be able to reuse code everywhere. You have to write the code once, and that’s it, after that you would be able to use it over different platforms easily. People may argue that you can do this with other frameworks like React Native, but who wants to learn React when you could just use HTML, CSS, and JS?

Alternatives

Although Electron.JS is one of the best cross-platform web application development systems, here are some alternatives to Electron.js that can provide you near about all the features that you get with Electron.js.

Proton Native – Using Proton Native framework, we can create native desktop applications through a React syntax, on all platforms. Other than Electron, native React support make Proton native an upper hand, but most machine level API’s, packages/libraries are not available in Proton Native compared to Electron.

Photon– The first in the list is Photon, which is the fastest way to build an application using HTML and CSS.

NW.JS– This framework is also a project based on a chromium system engine like Electron.js. Moreover, you are also able to get node modules and many more things.

Neutralino.js- Brought to my attention recently, it is almost exactly like electron, but uses your OS's default browser instead of chromium, increasing speed and decreasing RAM usage.

Conclusion We have come to the end of this article, in which we have discussed everything about Electron.js. Moreover, in this article, we have talked about every feature and benefit that you would be able to get with Electron.js. At last we listed some of the alternatives to Electron.js.

Thank you for reading this article!