In short? Electron JS is a framework for creating native applications with web technologies like Javascript, Html & CSS. Yes — you heard that right, you can use HTML to create awesome native applications that can run across multiple platforms including macOS, Windows, and Linux. Many popular applications like Visual Studio Code, Slack, Discord, Twitch, and WhatsApp are created in Electron.
First, open your coding editors and get ready for programming. Let’s create a very simple application. We will start with coding and then look at the theoretical part.
npm init -y
npm install --save-dev electron
"start": electron .
npm start
Electron will try to run the file specified in the main
option of package.json"main": main.js
main.js
with the following content : console.log("Hello World");
{
"name": "your-electron-app",
"version": "1.0.0",
"description": "",
"main": "main.js",
"devDependencies": {
"electron": "^10.1.2",
},
"scripts": {
"start": "electron .",
},
"author": "",
"license": "ISC"
}
console.log(“Hello World”);
On `npm start` electron will run `main.js` file, you should see “Hello World” in the terminal console. One interesting thing here is that the application will keep running and will be loaded in the memory of your computer. It’s up to the user to shut it down. Now we need to create a graphical user interface(GUI) to interact with our application. For this, we will use pure HTML and JS.
#react #javascript #electron #software-development #reactjs