<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[FOLK Developers - Medium]]></title>
        <description><![CDATA[We aim to reach out to developers worldwide, who learn,share and contribute. - Medium]]></description>
        <link>https://medium.com/folkdevelopers?source=rss----ad4c61fb2ecf---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>FOLK Developers - Medium</title>
            <link>https://medium.com/folkdevelopers?source=rss----ad4c61fb2ecf---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 11:07:09 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/folkdevelopers" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Best Practices for Maintaining and Scaling Flutter Applications]]></title>
            <link>https://medium.com/folkdevelopers/best-practices-for-maintaining-and-scaling-flutter-applications-a1d97491bdfd?source=rss----ad4c61fb2ecf---4</link>
            <guid isPermaLink="false">https://medium.com/p/a1d97491bdfd</guid>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter-app-development]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[clean-architecture]]></category>
            <category><![CDATA[flutter]]></category>
            <dc:creator><![CDATA[ADITYA MOTALE]]></dc:creator>
            <pubDate>Fri, 24 Dec 2021 06:35:18 GMT</pubDate>
            <atom:updated>2021-12-24T06:35:18.105Z</atom:updated>
            <cc:license>http://creativecommons.org/publicdomain/zero/1.0/</cc:license>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JswVPwzC_Dk2dXaf828piQ.png" /></figure><h4>Maintainable and Scalable codebase is arguably the most important consideration when building an app because it is essentially an insurance policy for your code.</h4><p>When organizations talk about scalable codebase, we often hear that they say,</p><blockquote>The app needs to be scalable so that it can handle both the growing number of users and support new features without breaking the existing ones.</blockquote><p>But that’s not all! A Flutter app should have a compossible structure that is easy to test, debug and understood by everyone working on it.</p><p>Also scalable code ensures that you have the right architecture in place to be able to add new features to an application without breaking the rest of it. It also makes opening pull requests and merging them less scary because you can be sure that your contribution will not introduce new problems. Also teams should be able to scale new features.</p><p>Howdy! 👋 My name is Aditya. Currently I’m doing an Internship at <a href="https://folkdevelopers.com/">FOLK Developers</a> as a frontend developer. While working, I have learnt some helpful techniques that will come handy to you while scaling the codebase for your flutter app or in general to any codebase.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FflbcUFdLSHwZC03p11%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FflbcUFdLSHwZC03p11%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia4.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExcnJha3YxOGo4cGlsMWJrZHRtaTU4MDNyazNkNDVmNnd5M3B0YW9teiZlcD12MV9naWZzX2dpZklkJmN0PWc%2FflbcUFdLSHwZC03p11%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="268" frameborder="0" scrolling="no"><a href="https://medium.com/media/75f65a7d8a7c8948f770ef420203dd44/href">https://medium.com/media/75f65a7d8a7c8948f770ef420203dd44/href</a></iframe><p>In this article we are not going to talk about what <strong>you</strong> <strong>should do</strong> but rather <strong>you could do</strong>. As each project is different so are the people working on it. So in here we will define abstract standards that you can extend in your project in order to make your codebase truly scalable.</p><p>If you still wondering what scalable codebase is or what do you mean by scalable codebase? So here is the definition —</p><blockquote>Making your codebase scalable means that if a new feature or requirement come to you, in how much change, you can adapt to that feature without breaking existing one’s. Also the lesser the lines required the more scalable codebase is.</blockquote><p>So let’s start with advantages of scalable codebase. Scalable code can help you avoid spaghetti code. Many developers have a horror story about a legacy codebase where deploying any new code meant breaking some other part of the codebase.</p><p>So let me ask! Have you ever been in a situation where you just finished implementing an awesome new feature that the user’s will love, but when you start testing it, certainly it starts to break other functionalities of the app, some random unnecessary bugs are jumping around and you desperately try to solve it. Finally in the end when everything is working fine you realize that you spent more time solving the bugs and fixing the functionalities than creating the feature itself.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2Ffnpy7E5Sm1LSOvHvu8%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2Ffnpy7E5Sm1LSOvHvu8%2Fgiphy.gif&amp;image=https%3A%2F%2Fi.giphy.com%2Fmedia%2Ffnpy7E5Sm1LSOvHvu8%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/8dd7ece8fbf37cd7e6299e5875a28e7a/href">https://medium.com/media/8dd7ece8fbf37cd7e6299e5875a28e7a/href</a></iframe><p>Now let’s imagine you are in an organization where the developer who has been around since day one has all the knowledge about the codebase but there is no documentation on it. Every time something breaks and you are not able fix it, you will have to hop on a video call with the person and could spend hours tracking down the problem. If that person ever leaves the company, the team loses all of that valuable knowledge and the codebase will be hard to maintain. We’ve probably all encountered a situation like this — or done it ourselves. So in short —</p><blockquote>Your codebase will not survive if one person has all of the knowledge in their head. That information needs to be documented and built into the architecture so that every member on the team knows how to build new features in a way that they will not break the existing infrastructure.</blockquote><h3>Coding Standards</h3><p>Specifying coding standards throughout the team/organization helps in making the code to be easily testable. If you want to reuse some kind of feature in your module which is already implemented in another module, without coding standards you will not be able to reuse the code easily. It’ll start creating mess and is a potential invitation to unwanted bugs. It will also make testing the code harder then it needs to. So lets start with -</p><h4>1. Naming Conventions (snake_case)</h4><p>snake_case is a naming style where <strong>all letters in the name are lowercase</strong> <strong>and</strong> <strong>it uses</strong> <strong><em>underscores</em></strong> <strong>to separate words</strong> in a name. In addition, in <strong>Angular</strong>, a dot is used to separate the name, type, and extension for file names. file_name.type.dart</p><p>Including the <strong>types </strong>in the file names make it easy to find a specific file type using a text editor or an IDE.</p><p>Most common files types are: .widget, .style, .service, .model, .util, .store</p><p>Create additional type names if you must but take care not to create too many.</p><p><strong>Examples</strong></p><ul><li>file_name.widget.dart</li><li>file_name.style.dart</li><li>file_name.model.dart</li><li>file_name.util.dart</li></ul><p>For more information on naming conventions and coding standards, <a href="https://blog.logicwind.com/best-practices-in-dart-flutter/">read this.</a></p><h4>2. Folder Structure</h4><p>There shouldn’t be any standard folder structure you should be fallowing for your codebase. But there are set of rules you can follow in order to make you feature set organized.</p><ol><li>You can create specific folders for each and every module of your app in order to separate the development process, it’ll help in encountering the bugs and error’s more accurately and can be tackled before production.</li><li>Inside of lib folder you can create a Core folder to store models, utils, widget components and helpers that can be used inside of any module across the application.</li><li>Inside a specific module, you can create folders for models, core and services to be used inside of specific module and can be easily reusable inside of it.</li><li>Following is the example of a folder structure with above mentioned principles.</li></ol><figure><img alt="Folder Structure example" src="https://cdn-images-1.medium.com/max/251/1*14VWXsq_1vRc8LC-eSSbDQ.png" /><figcaption>Folder Structure example</figcaption></figure><h4>3. Decoupling of views</h4><p>In Flutter decoupling of view stands for segregation of widgets from the main view in order to <strong>reuse and reduce number of lines of code</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d60d0a9f26668c9b93c94c48cc65e251/href">https://medium.com/media/d60d0a9f26668c9b93c94c48cc65e251/href</a></iframe><p>Flutter views represent the interface presented to the user. They provide interaction and allow the users to feel the essence of the application. Unfortunately, Flutter views are also often ignored, resulting in tightly coupled and non-reusable components. Which you should avoid to reduce the number of lines of code in order to make your code scalable.</p><p>Let’s imagine a usecase where you are defining a dialogebox which will show some content according to the callback. You are creating a separate dialogebox for each callback, after sometime you realize that all the dialogeboxes are not responsive according to the design requirements. It doesn’t make sense to edit all the values for all the widgets again and again. If you became a little lazy and specify a dialogebox widget in core of your module then you’ll be able to extend it according to your view’s needs.</p><blockquote>They always say that Lazy developers are the best developers which happens to be true in many ways.</blockquote><p>So back to decoupling. Decoupling also makes the process of testing and debugging of code easier and faster. Most importantly it’ll reduce the odds of unintentionally creating the bugs which can alter the performance and user experience.</p><h3>Architecture (Feature based)</h3><p>Feature is an essential concept to understand in any software design. It’s also used to describe user requirements for software development. Therefore, if we structure our projects by features, it will be easier to manage the codebase when it grows in feature set.</p><h4>Organize codebase by features</h4><pre>lib<br>...<br>  feature1<br>  feature2<br>  feature3<br>  feature4<br>    services<br>    utils<br>    managers</pre><p>As I mentioned above while explaining the folder structure that you can differentiate development process by feature sets. In complex apps, it’s hard to understand how different modules integrate. A feature-oriented architecture is helpful for this because we’ve grouped related logic (widgets|utils|pages|stores|models|..etc) into features. We don’t need to think about how the small parts work together but how features work together to construct the whole codebase. By analyzing dependencies between features the app could auto-generate understandable diagrams for developers to learn and test the codebase.</p><h4>Inside of Features</h4><p>To keep any feature from getting polluted, it’s important to decouple the <strong>business logic</strong> of that feature from its <strong>presentation</strong>. That’s why we should split the feature module into two different layers:</p><ul><li><strong>Infrastructure features:</strong> maintains services, repositories, models, utils, validators, interfaces, … etc.</li><li><strong>App features:</strong> maintains pages, widgets, styles, fonts, colors, …etc.</li></ul><h3>Steps for creating scalable codebase —</h3><p>Below we will discuss the four qualities we can strive for while creating scalable code. There is a huge risk associated with relying only on manual testing right before a scheduled release. Oftentimes critical bugs and stability issues surface, resulting in either a poor quality release or a postponed release date.</p><h3>1. Scalable code is boring</h3><p>You may think what makes a codebase boring? and how can a boring codebase be good?</p><blockquote>This ability to be able to find standard and reproducible patterns in the codebase makes it boring. <strong>Producing <em>boring code is the biggest compliment that an engineering team can receive</em></strong></blockquote><p>As <a href="https://verygood.ventures/team/jorge-coca"><strong>Jorge</strong></a><strong> </strong>from VVG said,</p><blockquote>Having a codebase that is predictable, easy to navigate, well tested and properly automated makes it <em>boring. But pleasantly boring! </em>And that’s great, teams love the feeling! It lets them focus on their <em>real and business-related challenges </em>without the distractions of other tasks.</blockquote><p>Codebases should be structured in such a way that any developer of any level — from Junior Developers to Senior Architects — should be able to understand the logic. In short, you should have a <strong>boring codebase</strong>.</p><p>You can achieve the boring codebase by -</p><ol><li>Stick to one state management library which is easy to understand by everyone working on the project. I’m biased about GetX so I prefer using it. Also, at the time of writing, it happens to be the most liked package on <a href="http://pub.dev/">pub.dev</a></li><li>Writing clear documentation is helpful for every person working on the project as it promotes easier flow of work and module requirements.</li><li>You can document the code in such a way that if you were to come back to the code in the future, you would be able to jump right back into it again. It will decrease the debugging time rapidly and help in increasing productivity.</li><li>Your team should be on the same page when it comes to naming variables, functions, and classes. The codebase also should conform to pre-existing standards whenever possible, including following the Effective <a href="https://dart.dev/guides/language/effective-dart">Dart style</a> guide and using popular packages wherever it makes sense.</li></ol><h3>2. Try to reach 100% of code coverage in your tests</h3><p>Testing the written code is foundational part of any development process. If you’re only testing once the app is complete, sorry but you’re doing it wrong! Testing should be baked into the development process and it needs to be validated right after the development.</p><blockquote><strong><em>Untested code is simply unscalable; if some part is left untested, you’re opening up the door to potential bugs or having your app not work the way it was intended.</em></strong></blockquote><p>For larger codebases it’s necessary that your tests reach 100% of code coverage. If your coverage is currently around 95% and your codebase has more than 20000 lines of code, this means that more than 1000 lines of code will left untested — it’s a significant amount!</p><p>For a comprehensive resource on testing — you can refer <a href="https://youtube.com/playlist?list=PLprI2satkVdFwpxo_bjFkCxXz5RluG8FY">this course</a></p><h3>3. The Process of debugging should be easy</h3><p>If bugs do surface in your codebase, tests you’ve written will likely fail. This can help you isolate the exact part of the code that is causing the issue in a matter of seconds and before the bug impacts end users. If the tests don’t fail and there is still a bug, that’s an indication that once the bug is identified and fixed, a test should immediately be added to ensure that bug never happens again.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FNaboQwhxK3gMU%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FNaboQwhxK3gMU%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia0.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExamJzODI0cDZoamJsamFqdHUyMGF4cnZ5M3VqMG1oZnZjbW52cG41biZlcD12MV9naWZzX2dpZklkJmN0PWc%2FNaboQwhxK3gMU%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="246" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec2f9c26faf01cc0b0bd4a0fc3b1a7f6/href">https://medium.com/media/ec2f9c26faf01cc0b0bd4a0fc3b1a7f6/href</a></iframe><p>Having built-in debuggers and widget inspectors can also make debugging that much easier. Flutter’s built-in tooling provides performance profiling and networking devtools which will help developers spot bugs quicker and then write tests to catch future ones.</p><h3>4. Scalable code is composable</h3><p>As we discussed earlier, scalable applications all have this one thing in common: they should be composed of smaller, independent packages or modules. This will ensure that each package has a single responsibility and can be tested and reused. This also ensures that everyone can work on the codebase in parallel without interrupting the work of other members. So you know, let’s go SOLID 😉</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*WYzwRFZCMooJWvRyy4TlkA.png" /><figcaption>SOLID</figcaption></figure><h3>TLDR;</h3><p>You may be wondering that who should be using this? Open source projects, independent developers, startups or Large enterprises — It’s for everyone</p><p>Scalable codebases should be an industry standard in flutter community, but unfortunately that’s not the case. Scalable codebase is fundamental requirement for any flutter project which is mainstream or planned to be. As it provides you with assurance that your feature set are well tested and are performing according to your requirement.</p><p>If your code coverage is not at 100%, set a goal to raise your current threshold by ten percent within the next couple of weeks. It’s all about implementing good, scalable habits now so that your codebase becomes more and more stable over time.</p><p>If you’re worried that your application’s codebase is not scalable, there’s no time like the present to start implementing habits that will put you on track. Unfortunately most people/organizations do choose a more bureaucratic approach and will not jump right into it. But if the project is already live then even if you think you have time and you will make your codebase scalable in near future, that’s not the case. Users will make their first impression on your app as a buggy and useless and will never come to use it again. Probably you are going to loose the initial userbase and your project will not get that strike to go on.</p><p>Thank you for reading! Have a good day</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FQM5lHSyFjz1XW%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fmedia.giphy.com%2Fmedia%2FQM5lHSyFjz1XW%2Fgiphy.gif&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2Fv1.Y2lkPTc5MGI3NjExY3V1b2wwNmh1Mzc0dTliODdyZHRyM3hpNjA5bXRwb2xncHZqeG1zayZlcD12MV9naWZzX2dpZklkJmN0PWc%2FQM5lHSyFjz1XW%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="265" frameborder="0" scrolling="no"><a href="https://medium.com/media/60562ef089b0994dc9ec46fa14eed5c6/href">https://medium.com/media/60562ef089b0994dc9ec46fa14eed5c6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1d97491bdfd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/folkdevelopers/best-practices-for-maintaining-and-scaling-flutter-applications-a1d97491bdfd">Best Practices for Maintaining and Scaling Flutter Applications</a> was originally published in <a href="https://medium.com/folkdevelopers">FOLK Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Guide to Electron with React]]></title>
            <link>https://medium.com/folkdevelopers/the-ultimate-guide-to-electron-with-react-8df8d73f4c97?source=rss----ad4c61fb2ecf---4</link>
            <guid isPermaLink="false">https://medium.com/p/8df8d73f4c97</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[technology]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Aditya Patnaik]]></dc:creator>
            <pubDate>Sat, 17 Oct 2020 08:29:11 GMT</pubDate>
            <atom:updated>2021-01-17T15:08:24.060Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pZzcIsmKGPBVRyZ2MWjpKQ.png" /></figure><p>Welcome to the Most Comprehensive Cross-Platform Desktop App Development journey.</p><p>In this article, we’ll learn how to implement powerful features of Electron with React. By the end of the article, you will be a maestro on the following implementations:</p><ol><li>How to create desktop app screens?</li><li>How to implement routes using react-router-dom on Electron?</li><li>How to make native calls from a React Component using the remote module?</li><li>How to trigger OS-specific dialogs from within a React component?</li><li>IPC(Inter-process Communication) in Electron.</li></ol><blockquote>Towards the end of the article, we have a surprise for you!</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/470/1*jkoCIr04_tZ6i8fACZQ5dQ.gif" /><figcaption>gif: excited Pikachu</figcaption></figure><h3>Prominent Apps built using Electron</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*VwPQAQ_7t0Iw666IzEzdQw.gif" /><figcaption>Products that are built using Electron</figcaption></figure><h3>Electron? I’m outta here if we’re learning physics!</h3><p><strong>Electron</strong> is a robust multi-process-architecture framework that runs on the chromium engine. It ensures that the heavy I/O and CPU-bound operations are put onto the new threads that would avoid blocking the UI(<strong><em>main process</em></strong>).</p><p>Electron ships with the latest version of Chrome. Its powerful features could be used to orchestrate heavy computations in an application window(<strong><em>renderer process</em>)</strong> that would enable the app to run at 60fps.</p><h3>Wait! What’s the main process? It sounds scary!</h3><p>The main process is the backbone of an Electron App. It can spawn multiple child processes(also called the renderer process). How? We will see that in a minute.</p><p>Let’s quickly set up a react app with Electron.</p><p>It is assumed that you have node and npm installed. Create a folder named <strong><em>electron-app</em></strong>. Open the folder in your favorite code editor.</p><p>Fire up a terminal and run npx create-react-app . with a dot at the end, which would create a react app in the current directory.</p><p>Create a file called<strong> <em>main.js</em></strong> under the public folder.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/359/1*XZkUnoibmphXd10Lg24GGg.png" /><figcaption>Screenshot:public folder</figcaption></figure><p>Copy the code given below to the <strong><em>main.js</em></strong> file. We’ll come back to what it does in some time.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8836f8f668cda1b82b21d69bedf5e5cc/href">https://medium.com/media/8836f8f668cda1b82b21d69bedf5e5cc/href</a></iframe><p>With that done, open up your <strong><em>package.json</em></strong> file.</p><p>Add the <strong><em>main</em></strong> entry that holds the path pointing to the <strong><em>main.js </em></strong>file, as shown below.</p><pre>//Dont forget to add a comma after this line</pre><pre>&quot;private&quot;:true,</pre><pre>//add this line</pre><pre><strong>&quot;main&quot;:&quot;public/main.js&quot;</strong></pre><p>Now we are ready to install Electron, open up the terminal, and run:</p><pre>npm i electron</pre><p>Now, let’s add an entry to the scripts section in the <strong><em>package.json</em></strong> file to run the react app on Electron.</p><p>Add <strong><em>electron-dev</em></strong> as an entry holding the value electron . under the scripts section in the package.json file as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/597/1*gVtpBvJyU2PQYiqFTgqXZA.png" /><figcaption>Screenshot: package.json — scripts section</figcaption></figure><p>If you have followed all the steps correctly, the <strong><em>package.json</em></strong> file should look as given below.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d9d76dbf6d1e4950a1b3a564a433fc8e/href">https://medium.com/media/d9d76dbf6d1e4950a1b3a564a433fc8e/href</a></iframe><p>Now, its time to start the electron app. As Electron emulates the react-app, we first need the react-app running.</p><p>Open a terminal instance and run:</p><pre>npm start</pre><p>Once the react app is up and running on the browser, open another terminal and run:</p><pre>npm run electron-dev</pre><p>You should see a native Desktop window running your very first electron app!</p><figure><img alt="" src="https://cdn-images-1.medium.com/proxy/1*m5fTzmW83RnD4RUVD9WkTg.png" /><figcaption>Screenshot:First Electron App with React</figcaption></figure><h3>Main Process</h3><p>An Electron app has a main process that creates the GUI by spawning BrowserWindows. Each BrowserWindow runs its isolated renderer process and gets destroyed when the BrowserWindow is closed. When we run the npm run electron-dev (runs electron . under the hood) command, the main process starts and initializes the Electron Environment.</p><p>Next, the main process looks for the main entry in the package.json file and runs the main file.</p><p>In the main.js file, Electron checks if the <strong><em>ready</em></strong> event has been already fired.</p><blockquote><strong>ready Event</strong></blockquote><blockquote>The first event that gets fired. It fires after Electron has finished initializing.To check if the <strong><em>ready</em></strong> event is fired, the <strong><em>isReady()</em></strong> or the <strong><em>whenReady() </em></strong>function is used.</blockquote><p>The <strong>whenReady() </strong>function returns a fulfilled promise only when the ready event has been fired.</p><pre>app.whenReady().then(createWindow)</pre><p>If the <strong><em>whenReady()</em></strong> function returns a fulfilled promise, the <strong><em>createWindow()</em></strong> function is executed. The <strong><em>createWindow() </em></strong>function spawns a new BrowserWindow instance and loads a webpage into it.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8c269b7ca05acfe50a6e17b6ae30ea9b/href">https://medium.com/media/8c269b7ca05acfe50a6e17b6ae30ea9b/href</a></iframe><h3>Renderer Process</h3><p>Each renderer process cares about the webpage running in it. A <strong><em>BrowserWindow </em></strong>seeks for an HTML file. In our case, the react-app has its <strong><em>index.html</em></strong> file running on port 3000. On passing the URL of an html file to the <em>loadURL()</em> function, Electron loads it on the <strong>BrowserWindow</strong>.</p><pre>win.loadURL(&#39;http://localhost:3000&#39;);</pre><p>If all BrowserWindows are closed signaling an app-exit operation, the <strong><em>window-all-closed</em></strong> event is triggered exactly after the last BrowserWindow instance closes. The <strong><em>quit() </em></strong>function from the app module quits the app.</p><blockquote><strong><em>window-all-closed Event</em></strong></blockquote><blockquote>The event is triggered when all BrowserWindows are closed.</blockquote><pre>app.on(&#39;window-all-closed&#39;, () =&gt; {<br>   if (process.platform !== &#39;darwin&#39;) {<br>      app.quit()<br>   }<br>})</pre><p>However, on macOS(darwin), it’s normal for an app to remain active in the dock until the user explicitly quits it, so we can keep the app active in the dock.</p><h3>Remote Module</h3><p>The remote module enables the renderer process to access APIs which are normally only available to the main process. To access them from a renderer process, the remote module uses an internal IPC channel to communicate with the main process. We’ll discuss IPC in detail later in this article. The remote module lets us access the GUI modules without having to explicitly send inter-process messages.</p><p>It’s important to understand that although we can access GUI modules in the renderer process, it’s often misunderstood that the modules are created in the renderer process. Because, in reality, the objects are created in the main process and are remotely shared with the renderer process.</p><pre>import React from &#39;react&#39;;<br><strong>// how to import the remote module in a React component?</strong><br>const electron = window.require(&#39;electron&#39;);<br>const remote = electron.remote<br>const {BrowserWindow,dialog,Menu} = remote</pre><p>Enable the remote module by setting the <strong><em>enableRemoteModule </em></strong>option<strong> </strong>to true.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f71be31a6da598aa576d038a666ad6ae/href">https://medium.com/media/f71be31a6da598aa576d038a666ad6ae/href</a></iframe><h3>BrowserWindow</h3><p>We have already seen what a BrowserWindow is and what it does. Let’s look at the BrowserWindow properties.</p><h4>How to Create a BrowserWindow?</h4><p>The line below creates a blank BrowserWindow.</p><pre>//width and height defaults to 800 by 600<br>const window = new BrowserWindow()</pre><p>We saw how to load an HTML file from a URL using the <strong><em>loadURL() </em></strong>function. However, in production, we bundle files/modules that we need the most. The <strong><em>loadFile()</em></strong> function helps in loading the HTML file from the assets.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a86216a3ed4e9bc2cce07891d2198556/href">https://medium.com/media/a86216a3ed4e9bc2cce07891d2198556/href</a></iframe><p>Here’s how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*T1mZlyoO9B51rPlDSdf1kQ.gif" /><figcaption>gif: BrowserWindow loads Electron’s official website</figcaption></figure><h4>Setting Dimensions</h4><p>The BrowserWindow API gives away properties to set the dimensions of a BrowserWindow.</p><pre>function createWindow () {<br>const windowOne = new BrowserWindow({width:400,height:400})<br>}</pre><p>The example above creates a BrowserWindow with dimensions 400 by 400. However, it would stretch endlessly which may not be the expected behavior.</p><p>You can set an upper/lower cap by setting the maxHeight, maxWidth, minHeight, and minWidth properties.</p><pre>function createWindow () {<br> const windowOne = new BrowserWindow({<br>       width:500,<br>       height:500,<br>       maxHeight:600,<br>       maxWidth:600,<br>       minHeight:400,<br>       minWidth:400,<br>       backgroundColor:&#39;#7B435B&#39;</pre><pre>})<br>}</pre><p>Now the window is stretchable only between the dimensions 400 x 400 and 600 x 600. Awesome!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*KtAHl31wk38Tf89ksEFdrA.gif" /><figcaption>gif: BrowserWindow stretches between 400x400 and 600x600</figcaption></figure><h4>Custom Title</h4><p>If not explicitly defined as shown below, the title of a BrowserWindow would be the same as the app-name defined in the package.json file. Or, if a title is defined in the HTML file running on it, that would be taken as the title.</p><pre>function createWindow () {<br> const windowOne = new BrowserWindow({<br>           title:&quot;My First App&quot;<br> })<br>}</pre><h4>How to Create a Frameless BrowserWindow?</h4><p>By setting the frame property to false, a BrowserWindow removes parts of a native window, like Menu, toolbar, close and minimize buttons.</p><pre>function createWindow () {<br> const windowOne = new BrowserWindow({<br>           title:&quot;My First App&quot;,<br>           frame:false<br> })<br>}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_dCvd44N-it-tXRcnk2PqQ.png" /><figcaption>Screenshot: Frameless BrowserWindow</figcaption></figure><h4>Creation of Parent and Child Windows</h4><p>If a parent property is defined on a BrowserWindow, then that BrowserWindow becomes a child window to the BrowserWindow that has been assigned as its parent window.</p><pre>function createWindow () {<br> let heyparent = new BrowserWindow()<br> let heychild = new BrowserWindow({ parent: heyparent })<br> heychild.show()<br> heyparent.show()<br>}</pre><p>A child window always stays on top of the parent window.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*snqCjVLVAygSiP-B3qr0uQ.gif" /><figcaption>gif: Parent and Child BrowserWindows</figcaption></figure><h4>Modal Window</h4><p>How to disable a parent window when a child window pops up? That’s exactly what a modal window does. To create a modal window, you need to set both the parent and modal properties.</p><pre>const parent = new BrowserWindow()</pre><pre>const child = new BrowserWindow({ parent: top, modal: true})<br>child.loadURL(&#39;https://github.com&#39;)</pre><p>While the above approach successfully creates a modal window, Electron loads it with a slight delay. So, the recommended way is to set the<strong><em> show </em></strong>property to false.</p><p>Now as soon as the child window gets rendered, show it by running the show function. But, how to detect when a page finishes getting rendered?</p><p>As soon as a webpage renders, the <strong><em>ready-to-show</em></strong> event is fired.</p><blockquote><strong>ready-to-show event</strong></blockquote><blockquote>This event is a renderer process event, emitted when the web page has been rendered (while not being shown) and window can be displayed without a visual flash.</blockquote><p>When the <strong><em>ready-to-show </em></strong>event is fired the webpage could then be shown using the <strong><em>show()</em></strong> function without the delay.</p><pre>const parent = new BrowserWindow()</pre><pre>// recommended <br>const child = new BrowserWindow({ <br>    parent: parent,<br>    modal: true, <br>    show: false<br> })</pre><pre>child.loadURL(&#39;https://github.com&#39;)<br>//show as soon as the file is rendered<br>child.once(&#39;ready-to-show&#39;, () =&gt; {   child.show() })</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Gv3oYJmHGXrzP1_cnH4JKQ.gif" /><figcaption>gif: Modal window disables parent window</figcaption></figure><h4>How to remove/hide the MenuBar?</h4><p>Call the <strong>removeMenu()</strong> function or set the Menu to null by using <strong>setMenu()</strong> function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ec9c40b05bd69fb47e7370e81edd2291/href">https://medium.com/media/ec9c40b05bd69fb47e7370e81edd2291/href</a></iframe><p>Here’s how a BrowserWindow looks with the menu bar removed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/984/1*mndov-qkBvh_HVsH4jWDiA.png" /><figcaption>Screenshot: Menu-less BrowserWindow</figcaption></figure><h4>Open a BrowserWindow from a React Component</h4><p>The component has a button that fires-up a BrowserWindow on click.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1d2be797fbcd7b610e5905f724543963/href">https://medium.com/media/1d2be797fbcd7b610e5905f724543963/href</a></iframe><p>Here’s how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*rtOf3JpMRYHlptZCN7g4bg.gif" /><figcaption>gif: Open a BrowserWindow from a React Component on button click</figcaption></figure><h3>How to open a Dialog in Electron from a React Component?</h3><p>We’ll discuss three prominent dialogs. We’ll trigger each with a click of a button from a React Component.</p><h4>showErrorBox()</h4><p>Displays a dialog that shows an error message. It takes two parameters, a <strong><em>title: string </em></strong>and a <strong><em>content: string</em></strong>. It is used to report errors at the startup. Hence, this could be safely used before the ready event.</p><pre>import React from &#39;react&#39;;<br>const electron = window.require(&#39;electron&#39;);<br>const remote = electron.remote<br>const {dialog} = remote</pre><pre>const App = () =&gt;{</pre><pre>return(</pre><pre>  &lt;button onClick={()=&gt;{</pre><pre>   dialog.showErrorBox(&#39;Error Box&#39;,&#39;Fatal Error&#39;)</pre><pre>  }}&gt;Show Error Box&lt;/button&gt;<br> )<br>}</pre><pre>export default App</pre><p>Let’s see it in action</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*ntV47YaW4i6exyZ8pTOakg.gif" /><figcaption>gif: Error Box on a button click</figcaption></figure><h4>showOpenDialog()</h4><p>Acts as a file selector or a directory selector. The properties array could be set to define the behavior of the dialog. This function returns a Promise that resolves to an object with the following properties:</p><p>cancelled : Boolean — whether or not the dialog was canceled.</p><p>filePaths: Array — An array of file paths selected.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8009b113737547907d1249bb9478306a/href">https://medium.com/media/8009b113737547907d1249bb9478306a/href</a></iframe><p>You can also specify filters to limit the user to select specific file types.</p><pre>dialog.showOpenDialog({<br>   title: &#39;Title&#39;,<br>   message: &#39;Message&#39;<br>    filters: [<br>    { name: &#39;Images&#39;, extensions: [&#39;jpg&#39;, &#39;png&#39;, &#39;gif&#39;] },<br>    { name: &#39;Movies&#39;, extensions: [&#39;mkv&#39;, &#39;avi&#39;, &#39;mp4&#39;] },<br>    { name: &#39;Custom File Type&#39;, extensions: [&#39;as&#39;] },<br>    { name: &#39;All Files&#39;, extensions: [&#39;*&#39;] }<br>  ]<br>})</pre><p>Here’s how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*3qDlBC3KOU27v_sv-vaPdg.gif" /><figcaption>gif: File selector dialog on a button click</figcaption></figure><h4>showMessageBox()</h4><p>Shows different types of dialogs based on the <strong><em>type </em></strong>specified. This dialog function also takes buttons, checkboxes, etc. The Message Box blocks the process until the dialog is closed. This function returns a Promise that resolves to an object with the following properties:</p><p>response: Index of the clicked Button</p><p>checkboxChecked: Boolean — Whether or not the checkbox is checked.</p><p>The following is a demonstration of different types of Message Boxes with its most used parameters.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1163222e7babc7e6f8dc2177f1891839/href">https://medium.com/media/1163222e7babc7e6f8dc2177f1891839/href</a></iframe><p>Here’s how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*5kfsVcdtp854xZJmIMc2dw.gif" /><figcaption>gif: Multiple message box types on a button click</figcaption></figure><h3>How to build a custom Menu in Electron?</h3><p>Generally, it’s best to set a menu in the ready event. However, let’s first set it from a react component on a button click.</p><h4>buildFromTemplate</h4><p>The <strong><em>buildFromTemplate </em></strong>function takes an array of options(template) and returns a Menu instance. Each option is an object that takes the following parameters: <strong><em>label: string, click: function,type: string, submenu: array(options) </em></strong>and<strong><em> role: name-of-a-role.</em></strong></p><pre>// option:object<br>{</pre><pre>label:&#39;options&#39;,</pre><pre>submenu:[</pre><pre>{role:&#39;selectall&#39;},</pre><pre>{role:&#39;reload&#39;}</pre><pre>]</pre><pre>}</pre><h4>setApplicationMenu</h4><p>Takes a Menu instance as a parameter and sets the Menu as each window’s top menu.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3f871b9a9b38698129e1103e60315d14/href">https://medium.com/media/3f871b9a9b38698129e1103e60315d14/href</a></iframe><p>See it in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*XNDUagIYg7RZrIWvG1njyQ.gif" /><figcaption>gif: Custom Menu</figcaption></figure><h4>Menu with the role, separator, and submenu properties</h4><p>In the following example, we will see the menu with separator, submenus, and roles.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f3c2d83e6b5f5c2e515ac6839678f6fb/href">https://medium.com/media/f3c2d83e6b5f5c2e515ac6839678f6fb/href</a></iframe><p>Here’s how it looks.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*JOHdFj-znvZA7ZirWNTJpg.gif" /><figcaption>gif: Custom Menu with Submenu,separator and roles</figcaption></figure><h3>How to implement Routes in Electron with React</h3><h4>Why not use BrowserRouter?</h4><p>Conventionally, in a react app, we enclose our Routes in a BrowserRouter component. The BrowserRouter component implements a routing mechanism that is best suited for a request based environment. Here’s a simple example that demonstrates routing in a react-app.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/08f310a3ee9e9b6695845283ed092ce9/href">https://medium.com/media/08f310a3ee9e9b6695845283ed092ce9/href</a></iframe><p>Though the BrowserRouter component works well with request based frameworks like react, it may not work at all with file-based environments like Electron. However, the react-router-dom package has us covered for all our routing cases.</p><h4>Hash Router to the rescue!</h4><p>The react-router-dom package ships with the Hash Router Component that works like a BrowserRouter in a file-based environment.</p><p>Routes using the Hash Router component can be set up in the same way as with BrowserRouter. All you need to change in the BrowserRouter based implementation is to replace the BrowserRouter component with the HashRouter component and you are good to go. Here are the BrowserRouter based routes modified to work with Electron.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/96b0c120ba5dd168fe3624cf8c78b6ce/href">https://medium.com/media/96b0c120ba5dd168fe3624cf8c78b6ce/href</a></iframe><p>Let’s see that in action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*Gjv4nMUXuBiBEONKC9kXog.gif" /><figcaption>gif: Routes using HashRouter</figcaption></figure><p>Great! So far we have learned to create/modify BrowserWindows, ran pages in it, triggered some well-targeted OS-specific dialogs for a range of use cases, set up routes using HashRouter, accessed modules in the renderer process that are only accessible in the main process using the remote module. Let’s dig a little deeper and understand the heart of the Electron Framework, the IPC!</p><h3>Inter-Process Communication(IPC)</h3><p>We have learned about the <strong><em>main </em></strong>and<strong><em> renderer </em></strong>process.</p><blockquote><strong><em>Inter-process Communication</em></strong> refers to the mechanism provided by the operating system that allows two processes to interact with each other.</blockquote><p>Electron requires the main process to create/handle BrowserWindows, each running its own renderer process that runs a webpage. <strong>So, if a renderer process needs to make some changes to the GUI by making use of the native API, it could directly import the necessary native modules from Electron and call as it needs. Right?</strong></p><p>Wrong! A renderer process runs third-party libraries/webpages, hence, calling native GUI APIs could be fatal and may account for data leaks.</p><p>If a renderer process needs to perform a GUI operation on a webpage, <strong>it must communicate with the <em>main </em>process that could in turn operate only after validating if the native-operation-request is indeed valid</strong>.</p><p>The communication between the main and renderer process could be synchronous or asynchronous based on the requirement.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vmd8XMRvG0KdpIib3yalgQ.png" /><figcaption>Screenshot:Illustration depicting Inter-process communication between main and renderer process</figcaption></figure><p>The renderer process sends a request to the main process on a specified channel for the execution of a native operation with some arguments and the main process fulfills the request by executing the operation on the native API with the arguments on the webpage asynchronously.</p><h4>on() and once()</h4><p>Both ipcMain and ipcRenderer modules have ‘<strong><em>on’</em></strong> and ‘<strong><em>once’ </em></strong>methods to listen for events on a specific channel.</p><pre>//<strong>channel:</strong>string and <strong>listener:</strong>callback with event and args as function parameters</pre><pre>// main process<br>ipcMain.on(channel, listener)<br>ipcMain.once(channel, listener)</pre><pre>// renderer process<br>ipcRenderer.on(channel,listener) <br>ipcRenderer.once(channel,listener)</pre><p>When a new message arrives on a specified channel the callback(listener) would be executed with the parameters passed.</p><p>The ‘<strong><em>once</em></strong>’ function also behaves in the same way, the only difference is that it gets removed after listening once to an event.</p><h4>send()</h4><p>The ipcRenderer module has a ‘<strong><em>send’ </em></strong>method to send messages to a specified channel.</p><pre>// channel:string(channel name), <br>// args to be sent through the channel<br>// to the main process.<br>ipcRenderer.send(channel,...args)</pre><h4>removeListener() and removeAllListeners()</h4><p>There are situations where many renderer processes subscribe to a channel on the main process, you may want to remove one or all listeners at once for better performance. The ipcMain module ships with the <strong><em>removeListener</em></strong> and <strong><em>removeAllListeners </em></strong>methods that remove a specified listener and all listeners from a channel respectively.</p><pre>// removes a specific listener from a specified channel<br>removeListener(channel,listener)</pre><pre>// removes all listeners from a channel<br>removeAllListeners([channel])</pre><h4>Asynchronous Message Exchange</h4><p>Assume that you want to call a native API from a renderer process, you would naturally make an IPC call to the main process as native APIs are inaccessible in the renderer process. But what if the requested native operation is a heavy one? If that’s the case the IPC call will end up blocking the UI till the heavy native operation has finished its execution. The non-blocking asynchronous <strong><em>send</em></strong> function solves this problem.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c19232d7f5f2d9f443e543dc81ed1a9b/href">https://medium.com/media/c19232d7f5f2d9f443e543dc81ed1a9b/href</a></iframe><p>The main process can also send a<em> </em><strong><em>reply</em></strong> asynchronously with some meta-data after fulfilling the request.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/42d517dbf4cca7f0c58eabfceccded95/href">https://medium.com/media/42d517dbf4cca7f0c58eabfceccded95/href</a></iframe><h4>Synchronous Message Exchange</h4><p>There could be situations where some user activity may need an immediate change in the UI. For all such urgent triggers in the UI, the synchronous way of exchange could be used.</p><p>The ipcRenderer module ships with a ‘<strong><em>sendSync</em></strong>’ function that behaves exactly like the ‘<strong><em>send</em></strong>’ function but behaves synchronously. That also means any requests sent synchronously has to be light in terms of resource utilization as otherwise, it may block the UI from rendering seamlessly.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/aa41442deaab0642566f48ccdc39e842/href">https://medium.com/media/aa41442deaab0642566f48ccdc39e842/href</a></iframe><p>Let’s try to implement what we have learned so far on React.</p><h3>Let’s see the IPC in action with a React component</h3><p>We will send messages to the main process from a react component on a button click both synchronously and asynchronously.</p><p>Let’s create two buttons in the App component. Each for synchronously as well as asynchronously sending a string to the main process.</p><h4><a href="https://gist.github.com/adityapatnaik/0879a40c35cbdb32745a177049dccf1b">App.js</a></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3365bdaf06ba4730c4e40fb271738310/href">https://medium.com/media/3365bdaf06ba4730c4e40fb271738310/href</a></iframe><p>In the main.js file, create an ‘<strong><em>on</em></strong>’ function to listen to the messages sent on the ‘<strong><em>anything-synchronous</em></strong>’ and ‘<strong><em>anything-asynchronous</em></strong>’ channels.</p><h4><a href="https://gist.github.com/adityapatnaik/d76a75c1bb9f4de841a9e042bbae1f7d">main.js</a></h4><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6e09a8603d8f0775a4d4f009fd182135/href">https://medium.com/media/6e09a8603d8f0775a4d4f009fd182135/href</a></iframe><p>Here’s how it would look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*zWv0lrOCxMyjfEqsPQRPKw.gif" /><figcaption>gif: IPC send function(async and sync)</figcaption></figure><h4>Let’s also send a reply to the renderer process(App component) from the main process both synchronously and asynchronously.</h4><h4>Asynchronous Reply</h4><p>To send a reply to an asynchronous message, the ‘<strong><em>event.reply</em></strong>’ method is used.</p><p>The asynchronous reply is sent on a different channel so that the meta-data passed as a reply doesn’t clog the main channel where the native requests are made by the renderer processes.</p><p><a href="https://gist.github.com/adityapatnaik/36134bb1b4869d0cd5eaf39ddc173d69"><strong>main.js</strong></a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/11a74a1ab9e22f9d73b05e61d77d2640/href">https://medium.com/media/11a74a1ab9e22f9d73b05e61d77d2640/href</a></iframe><p><a href="https://gist.github.com/adityapatnaik/1c037191c0aebb93d0febe5c1f8174cc"><strong>App.js</strong></a></p><p>Since the reply is sent on a different channel by the main process, the renderer process should be listening to it in order to accept the reply.</p><p>The ‘<strong>on</strong>’ method is used with a listener(callback) that would catch the reply in the ‘<strong><em>arg</em></strong>’ param passed to the listener.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9d4f2014d852da247f42ebb8bc60a998/href">https://medium.com/media/9d4f2014d852da247f42ebb8bc60a998/href</a></iframe><h4>Synchronous Reply</h4><p>In order to send a reply synchronously, set the ‘<strong><em>event.returnValue</em></strong>’ to the data to be passed as a reply.</p><p><a href="https://gist.github.com/adityapatnaik/06ce0c3b759db54f3db47dfa2e183049"><strong>main.js</strong></a></p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9a8432b76b20e5b544d1891f16b7fd73/href">https://medium.com/media/9a8432b76b20e5b544d1891f16b7fd73/href</a></iframe><p><a href="https://gist.github.com/adityapatnaik/5728126ae1095b5383a611d33e5b571d"><strong>App.js</strong></a></p><p>And here’s how you catch it in the renderer process i.e. App component.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/1fb4c8c5e8d1d8a35a9d4542594cfdb5/href">https://medium.com/media/1fb4c8c5e8d1d8a35a9d4542594cfdb5/href</a></iframe><p>Here’s how it would look like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*L33_yu2Npjsi0yEDuiO9Fw.gif" /><figcaption>gif: IPC two-way message exchange (sync and async)</figcaption></figure><p>On the left is the renderer process running the App component, on the right is the main process. On the browser console, you can see the messages sent by the main process in reply to both asynchronous and synchronous messages sent by the renderer process.</p><h4>Surprise! Good News for you!</h4><p>Microsoft has been trying to implement its blazing fast WASM(WebAssembly) enabled .NET based cross-platform app development framework <strong>BLAZOR</strong> on Electron. That would be a humongous performance upgrade for Apps made with Electron with little or no changes to the code base.</p><blockquote>If you have reached this far, give yourself a pat on the back. You did a great job. With Electron,you have started your development journey with a Bang!</blockquote><p>A Big Thank You for giving us your time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*rHuMSNiP_9-VY9MwDXrzuA.gif" /><figcaption>gif: Thank You</figcaption></figure><p>I wish you all the very best for the future!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*UX3p7WMPuQWnhcSw9EeVfQ.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8df8d73f4c97" width="1" height="1" alt=""><hr><p><a href="https://medium.com/folkdevelopers/the-ultimate-guide-to-electron-with-react-8df8d73f4c97">The Ultimate Guide to Electron with React</a> was originally published in <a href="https://medium.com/folkdevelopers">FOLK Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[FOLK Developers Submission Guidelines]]></title>
            <link>https://medium.com/folkdevelopers/folk-developers-submission-guidelines-c0c1a3c36ee0?source=rss----ad4c61fb2ecf---4</link>
            <guid isPermaLink="false">https://medium.com/p/c0c1a3c36ee0</guid>
            <dc:creator><![CDATA[Developer FOLK]]></dc:creator>
            <pubDate>Fri, 16 Oct 2020 19:13:39 GMT</pubDate>
            <atom:updated>2020-10-23T18:37:47.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z_4gctAwLl8heSG3SrYHfg.png" /></figure><p>We’ve arranged a civilization in which most crucial elements profoundly depend on technology and its application. <strong>FOLK Developers</strong> publish at the intersection between technology and the art to apply it in mindful ways. We believe in the philosophy of creating content and then wait until our readers come around in need of it.</p><p><strong>FOLK Developers</strong> connects you with a community of tech professionals, scholars, and impactful people who cling to the ideology that quality is everybody’s responsibility that makes way for our nifty content.</p><p>We would like to offer a few tips that would make sure your great article gets a tinge of our excellence by meeting the following quality checks.</p><h3>Do’s</h3><ul><li><strong>Good things, when short, are twice as good</strong>. Be brief but comprehensive, people are reading your article because they think you have something new to share. Good writing is about subtracting the obvious and adding the meaningful.</li><li><strong>A technical article should be at least four minutes in length.</strong> If it’s any shorter then it’s not telling very much about the topic.</li><li><strong>Who likes just a wall of text?</strong> Add some gifs and graphics to spice things up. Make use of diagrams/illustrations wherever possible.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*NCIrEkGqRBmMS42gz3TGsA.gif" /></figure><ul><li><strong>Everyone is busy</strong>. Write being respectful of the reader’s time by taking as little of it as possible, a silver bullet to get people to pay attention.</li><li><strong>Add an engaging header image at the top of your article.</strong> As that is the first thing that is seen by your reader especially when the reader is browsing through a list of articles.</li><li><strong>Readers love code demonstrations.</strong> Make use of medium embeds such as <a href="https://gist.github.com/">Github gists</a>, <a href="https://codesandbox.io/">CodeSandbox</a>, <a href="https://codepen.io/">Codepen</a>, <a href="https://stackblitz.com/">Stackblitz</a> and many more to embed code to your tech-savvy article.</li><li><strong>If you are using a copyrighted media please make sure to make a mention of the creator’s name under the media.</strong> Say, if it’s an image, add the source of the image in the image-text.</li><li><strong>Be unique and creative.</strong> If you submit an article about “How to center a div using CSS” then we may probably send you links to all other articles that talk about aligning divs using CSS.</li><li><strong>Use the free version of <em>Grammarly</em></strong>. Unless you are someone who is writing an outstanding technical article on a hot topic but with poor English skills, we’re not going to rewrite it for you.</li><li>If English is your first language and you make grammatical, spelling, semantic errors then your submission may get bounced back to you.</li><li>When we have written something and we give it a re-read we spot a few errors. However, when we read the same thing a week later we tend to notice many more embarrassing errors and we end up laughing at ourselves. So re-reading a piece, a few times really helps.</li></ul><h3>Don’ts</h3><ul><li><strong>Don’t send us articles of technical opinions</strong>. Don’t send us write-ups that don’t tell anything new to the readers or if it’s an opinion from start to finish.</li><li><strong>Don’t write copies of documentation and pass that as an article.</strong> It won’t get published.</li><li><strong>We don’t encourage you to write a guide to install some package or tool</strong> as that would already be mentioned in the product’s/tool’s/package’s readme. We don’t want another copy of that here.</li><li><strong>Don’t send us advertisements disguised as articles.</strong></li><li><strong>Don’t send us a bunch of short articles</strong> that are all two to three minutes each or even less.</li><li><strong>Don’t use copyright content without mentioning the name of the creator.</strong></li></ul><h3>Submission</h3><p>If you would like to have your article featured, please feel free to email or reach out to our Editor on twitter.<strong> Please share your articles in the draft mode only.</strong></p><p>Aditya Patnaik</p><p>Email: adityapatnaik25x@gmail.com</p><p>Twitter: ( @adityapatnaik_ )</p><p>Instagram: ( @adityapatnaik_ )</p><h3>Summary</h3><p>We need articles that would turn the publication into a learning-heaven. Great content would call for great readers and great readers would call for great contributors. And we seek to build a family out of all our developers/ readers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BRqvSNIHRXQqEcf54vFcMA.png" /></figure><p>Be unique, Be concise, Use <em>Grammarly</em>, Make your Article speak for itself. Make it visually expressive. Add demonstrations. Engage your readers in your article and make them feel at home.</p><p>Let’s build a community for everyone. Are you with us?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c0c1a3c36ee0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/folkdevelopers/folk-developers-submission-guidelines-c0c1a3c36ee0">FOLK Developers Submission Guidelines</a> was originally published in <a href="https://medium.com/folkdevelopers">FOLK Developers</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>