<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Sachith Siriwardana</title>
    <description>The latest articles on DEV Community by Sachith Siriwardana (@sachith1).</description>
    <link>https://dev.to/sachith1</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F359504%2F9eb91a58-5769-4000-bec5-419a44f3c088.jpeg</url>
      <title>DEV Community: Sachith Siriwardana</title>
      <link>https://dev.to/sachith1</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sachith1"/>
    <language>en</language>
    <item>
      <title>Handling React.lazy Chunk Load Errors After Deployment</title>
      <dc:creator>Sachith Siriwardana</dc:creator>
      <pubDate>Sun, 18 Oct 2026 06:19:49 +0000</pubDate>
      <link>https://dev.to/sachith1/handling-reactlazy-chunk-load-errors-after-deployment-185a</link>
      <guid>https://dev.to/sachith1/handling-reactlazy-chunk-load-errors-after-deployment-185a</guid>
      <description>&lt;p&gt;&lt;em&gt;Why old browser tabs request missing chunks—and how react-lazy-chunk-recover handles the failure without a reload loop.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;A user leaves a React app open during a deployment. Hours later, they visit a lazy-loaded route for the first time. Their old tab requests a chunk the new deployment no longer serves. The route fails, even though it works in a fresh tab.&lt;/p&gt;

&lt;p&gt;For example, the old tab might request &lt;code&gt;Reports.a1b2.js&lt;/code&gt; after the server has switched to &lt;code&gt;Reports.c3d4.js&lt;/code&gt;. The hashes are illustrative; the missing-file failure is the point. &lt;a href="https://vite.dev/guide/build.html#load-error-handling" rel="noopener noreferrer"&gt;Vite documents this deployment failure mode&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I built and published &lt;a href="https://www.npmjs.com/package/react-lazy-chunk-recover" rel="noopener noreferrer"&gt;react-lazy-chunk-recover&lt;/a&gt; to handle this case inside a &lt;code&gt;React.lazy&lt;/code&gt; component loader. It recognizes likely chunk-load errors, allows one guarded reload, and passes a repeat failure to your Error Boundary. The package includes TypeScript declarations, lists React as a peer dependency, and has no direct runtime dependencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why the usual &lt;code&gt;React.lazy&lt;/code&gt; setup cannot recover on its own
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;React.lazy&lt;/code&gt; waits until the first render to call your loader. While the import is pending, &lt;code&gt;&amp;lt;Suspense&amp;gt;&lt;/code&gt; shows a fallback. If the import rejects, React sends the error to the nearest Error Boundary. React also caches the loader promise and its result, so another render of the same lazy component does not simply start a new import. &lt;a href="https://react.dev/reference/react/lazy" rel="noopener noreferrer"&gt;React describes each behavior in its &lt;code&gt;lazy&lt;/code&gt; reference&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;An Error Boundary can explain the failure. It cannot, by itself, update the old tab's asset references. A reload may do that by fetching the current HTML and application bundle—but only if your deployment serves them correctly. An unconditional reload can trap the user when the error persists.&lt;/p&gt;

&lt;p&gt;The recovery code therefore needs two decisions: &lt;em&gt;Is this likely a chunk-load error?&lt;/em&gt; And &lt;em&gt;has this tab already tried to recover?&lt;/em&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How react-lazy-chunk-recover works
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fep7z5atwyg3tp127mutl.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fep7z5atwyg3tp127mutl.png" alt=" " width="800" height="450"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The package recognises dynamic-import messages such as &lt;code&gt;Failed to fetch dynamically imported module&lt;/code&gt; and &lt;code&gt;ChunkLoadError&lt;/code&gt;. For a matching failure, it reads a &lt;code&gt;sessionStorage&lt;/code&gt; guard. If no guard exists, it writes one and calls &lt;code&gt;window.location.reload()&lt;/code&gt;. If a guard already exists, it throws the error to React. A successful load clears the guard, so a later deployment can get its own recovery attempt.&lt;/p&gt;

&lt;p&gt;If the browser blocks &lt;code&gt;sessionStorage&lt;/code&gt;, the package throws the error instead of starting a reload it cannot limit. During server-side rendering, it skips browser storage and page reloads; it rethrows the original import error.&lt;/p&gt;

&lt;h2&gt;
  
  
  Let's use it on a lazy route
&lt;/h2&gt;

&lt;p&gt;Install the package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;react-lazy-chunk-recover
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then replace the &lt;code&gt;React.lazy&lt;/code&gt; call. Keep the lazy component at module scope, as &lt;a href="https://react.dev/reference/react/lazy#troubleshooting" rel="noopener noreferrer"&gt;React recommends&lt;/a&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Suspense&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;lazyWithRetry&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;react-lazy-chunk-recover&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Reports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lazyWithRetry&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Reports&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;moduleKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reports&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ReportsRoute&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Suspense&lt;/span&gt; &lt;span class="na"&gt;fallback&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loading reports…&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Reports&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Suspense&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;moduleKey&lt;/code&gt; gives this lazy loader its own guard. Use a &lt;strong&gt;stable, unique value for each logical lazy-loaded component&lt;/strong&gt;—for example, &lt;code&gt;reports&lt;/code&gt; and &lt;code&gt;settings&lt;/code&gt;. Keep the value the same across renders and deployments; do not generate a random key or reuse one key for unrelated components. Without &lt;code&gt;moduleKey&lt;/code&gt;, lazy components share the default guard, and one successful load can clear another component's recovery attempt.&lt;/p&gt;

&lt;p&gt;Keep your Error Boundary around the route. &lt;code&gt;&amp;lt;Suspense&amp;gt;&lt;/code&gt; handles the pending import; the Error Boundary handles a non-chunk error or a failed recovery. &lt;code&gt;lazyWithRetry&lt;/code&gt; does not export an Error Boundary or replace the one your app already uses.&lt;/p&gt;

&lt;p&gt;This wrapper targets components loaded through &lt;code&gt;React.lazy&lt;/code&gt;. It is not a replacement for React Router's separate route-module &lt;code&gt;lazy&lt;/code&gt; API or for every dynamic import in an application.&lt;/p&gt;

&lt;h2&gt;
  
  
  Configure retries for the failure you actually see
&lt;/h2&gt;

&lt;p&gt;The default &lt;code&gt;retries&lt;/code&gt; value is &lt;code&gt;0&lt;/code&gt;. That is deliberate: a second request for a deleted hashed file usually gets the same 404.&lt;/p&gt;

&lt;p&gt;If your telemetry also shows brief network interruptions, allow a small number of in-place retries:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Reports&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;lazyWithRetry&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="k"&gt;import&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./Reports&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;moduleKey&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;reports&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;retries&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;retryDelayMs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;250&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The loader makes up to two extra attempts, with the wait doubling after each attempt. It only enters the reload path if a recognised failure remains. Start with the default; add retries when your production errors justify the extra delay.&lt;/p&gt;

&lt;p&gt;For an application that publishes a trusted, current asset manifest, &lt;code&gt;getFreshModule&lt;/code&gt; offers one alternate import attempt before the reload. Your application must supply the URL and verify that the returned module is compatible with the running app. The package cannot derive a new hashed URL from the old import error. I would not enable that path without a defined manifest contract and a test that spans two builds.&lt;/p&gt;

&lt;h2&gt;
  
  
  Test it like a real deployment
&lt;/h2&gt;

&lt;p&gt;Use a staging environment, not production. In this test, &lt;strong&gt;build A&lt;/strong&gt; is the version already running in an open tab, and &lt;strong&gt;build B&lt;/strong&gt; is the newer version on the server. Pick one lazy route, such as &lt;code&gt;/reports&lt;/code&gt;. You want to see whether the old tab can reach the working route after its old chunk disappears.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First run: recovery succeeds&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Deploy build A. Open the app and leave that tab on a different route; do not open &lt;code&gt;/reports&lt;/code&gt; yet. Check the Network panel to make sure the route's chunk has not already been prefetched.&lt;/li&gt;
&lt;li&gt;Deploy build B without refreshing the old tab. In staging, make build A's &lt;code&gt;/reports&lt;/code&gt; chunk unavailable. If your host retains old files, block that exact old chunk URL in your browser's request-blocking tools instead.&lt;/li&gt;
&lt;li&gt;In the old tab, open &lt;code&gt;/reports&lt;/code&gt;. The request for build A's chunk should fail. Expect &lt;strong&gt;one&lt;/strong&gt; full-page reload, followed by the &lt;code&gt;/reports&lt;/code&gt; page from build B.&lt;/li&gt;
&lt;li&gt;Use the page, not just its heading. Confirm its important backend request or action still works with build B.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Second run: recovery cannot finish&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Start again with a clean browser session and repeat the setup, but make build B's &lt;code&gt;/reports&lt;/code&gt; chunk fail too. Expect at most one automatic reload. After the second failure, your Error Boundary should appear instead of another reload.&lt;/p&gt;

&lt;p&gt;Finally, refresh &lt;code&gt;/reports&lt;/code&gt; directly to confirm your server serves the app on a nested URL. In automated tests, also simulate blocked &lt;code&gt;sessionStorage&lt;/code&gt;; the package should throw the error rather than reload without a guard.&lt;/p&gt;

&lt;p&gt;Record the chunk-load failure, the attempted reload, and whether the route works against the current backend afterwards. The reload alone does not confirm recovery.&lt;/p&gt;

&lt;h2&gt;
  
  
  Plan for deployment compatibility too
&lt;/h2&gt;

&lt;p&gt;The wrapper handles a failure after it reaches a lazy component. Your release process also needs to decide whether an old client may keep running:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Retain old hashed assets only when the old client remains compatible and safe. An incompatible API change or urgent security fix may require old tabs to update instead.&lt;/li&gt;
&lt;li&gt;Let browsers revalidate the HTML entry point. &lt;a href="https://vite.dev/guide/build.html#load-error-handling" rel="noopener noreferrer"&gt;Vite recommends &lt;code&gt;Cache-Control: no-cache&lt;/code&gt; for HTML&lt;/a&gt; in this scenario.&lt;/li&gt;
&lt;li&gt;If you use Vite, review its &lt;code&gt;vite:preloadError&lt;/code&gt; event for dynamic-import failures outside this wrapper.&lt;/li&gt;
&lt;li&gt;Confirm that a full-page reload works on every client-side route.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If a release requires every open tab to update, use an explicit app-version or update policy. This package only reacts when a wrapped lazy import fails; it cannot force an update while old chunks continue to load. If the current build still cannot load the route, the package passes the failure to your Error Boundary instead of refreshing forever.&lt;/p&gt;

&lt;h2&gt;
  
  
  Final thoughts
&lt;/h2&gt;

&lt;p&gt;A deployment can change more than file names. It can change API contracts, fix a critical bug, or remove vulnerable client code. Keeping old chunks available may avoid a 404 while leaving an old tab on a version you no longer want running.&lt;/p&gt;

&lt;p&gt;That is why I built &lt;a href="https://www.npmjs.com/package/react-lazy-chunk-recover" rel="noopener noreferrer"&gt;react-lazy-chunk-recover&lt;/a&gt;: when a wrapped lazy import fails, the tab gets one guarded chance to load the current build. If it still fails, your Error Boundary takes over. The package does not replace a version policy for releases that must retire every old client.&lt;/p&gt;

&lt;p&gt;If you face stale-chunk failures, try the package on one lazy route and reproduce the two-build deployment described above. Check the route's backend interactions after the reload, not just its loading state. &lt;strong&gt;A reload is an attempt; a working route on the current build is recovery.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I would be interested to hear how your app handles breaking deployments and what chunk-load message your browser or bundler produces. If you try the package, share those details and whether the route worked after the reload. That feedback can help shape the next release.&lt;/p&gt;

&lt;p&gt;ENJOY YOUR CODING! 🚀&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>vite</category>
      <category>webpack</category>
    </item>
    <item>
      <title>Introduction to GPGPU Computing with CUDA and C++</title>
      <dc:creator>Sachith Siriwardana</dc:creator>
      <pubDate>Tue, 19 Oct 2021 13:14:45 +0000</pubDate>
      <link>https://dev.to/sachith1/introduction-to-gpgpu-computing-with-cuda-and-c-2nk2</link>
      <guid>https://dev.to/sachith1/introduction-to-gpgpu-computing-with-cuda-and-c-2nk2</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dtrcbb1nh6jij7f003w.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2dtrcbb1nh6jij7f003w.jpeg" alt=" " width="800" height="350"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Nowadays some software programs become complex and need huge computation power with sequential programming this is a problem but with parallel processing, the speed of the programs can be increased because it exploits the parallelism provided by the multi-core architecture. So developers Shift in the traditional paradigm of sequential programming, towards parallel processing when there is a need for huge parallelism....&lt;/p&gt;

&lt;p&gt;&lt;a href="https://sachithsiriwardana.medium.com/introduction-to-gpgpu-computing-with-cuda-and-c-51266a5e0d83" rel="noopener noreferrer"&gt;Read Full article&lt;/a&gt; &lt;/p&gt;

</description>
      <category>cpp</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Neutralinojs + React Starter Template</title>
      <dc:creator>Sachith Siriwardana</dc:creator>
      <pubDate>Fri, 01 May 2020 18:32:31 +0000</pubDate>
      <link>https://dev.to/sachith1/neutralinojs-react-starter-template-42le</link>
      <guid>https://dev.to/sachith1/neutralinojs-react-starter-template-42le</guid>
      <description>&lt;h1&gt;
  
  
  What is NeutralinoJs
&lt;/h1&gt;

&lt;p&gt;&lt;a href="//neutralino.js.org/"&gt;Neutralino&lt;/a&gt; is a lightweight and portable application development framework. It lets you develop cross-platform applications using JavaScript/Typescript, HTML and CSS.This framework is also similar to Electron, Nw.js, and a few more.&lt;/p&gt;

&lt;p&gt;The key difference of Neutralino is that it won’t run top of Chromium and NodeJs.&lt;/p&gt;

&lt;h1&gt;
  
  
  Why NeutralinoJs?
&lt;/h1&gt;

&lt;p&gt;Let’s see what NeutralinoJs docs says&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“ In Electron and NW.js you have to install NodeJs and hundreds of dependency libraries. Embedded Chromium and Node creates large overhead and makes even simple apps like “hello world” considerable in size. Neutralino offers a lightweight and portable SDK which is an alternative for Electron and NW.js also with many advantages. ”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With the rough idea that I have given above on NeutralinoJs, let’s focus on the topic which I am going to discuss from here. 😉&lt;br&gt;
&lt;em&gt;From now onward I may refer NeutralinoJs as Neu.&lt;/em&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Legacy Neu-React template
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnc5cpbyxokwj7esiywge.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fnc5cpbyxokwj7esiywge.PNG" alt="Legacy template where everything is written on index.html" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let’s talk about the &lt;a href="https://github.com/neutralinojs/neutralinojs-reactjs-template" rel="noopener noreferrer"&gt;old neu-react template&lt;/a&gt;. It was developed 2 years ago using an older version of NeutralinoJs. It transpile the javascript ES6+ code to ES5 each and every time when application started. Either it’s development or production there is no difference, it needs to transpile the code every time which makes it a bit slow.&lt;/p&gt;

&lt;p&gt;Also if you are going to use React with NeutralinoJs most of the time you are familiar with React, so you are familiar with component-based project structure but the template was not that much supporting the component-based structure.&lt;br&gt;
Thus, there are some differences between these two&lt;/p&gt;
&lt;h1&gt;
  
  
  The story of developing a new template
&lt;/h1&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7w6hup2nu39vafeptyi8.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F7w6hup2nu39vafeptyi8.PNG" alt="New template with more component-based structure" width="800" height="433"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This heading is the main reason for me to write this article. Most of the contribution to developing this &lt;a href="https://github.com/neutralinojs/neutralinojs-react" rel="noopener noreferrer"&gt;new template&lt;/a&gt; was done by me. 😎&lt;/p&gt;

&lt;p&gt;The real reason that allowed me to develop this project was a hackathon organized by 99X Technology called Hacktitude. Therefore, I participated and got selected for the top 10 contributors. From then on I was able to develop the project with the help of my mentors.&lt;/p&gt;

&lt;p&gt;So that’s how I got the opportunity to develop this awesome project and I’m really happy that I was able to contribute to NeutralinoJs.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That’s the long story in short&lt;/em&gt; 😉&lt;/p&gt;

&lt;p&gt;here is the new template 😎.&lt;br&gt;
&lt;/p&gt;
&lt;div class="ltag-github-readme-tag"&gt;
  &lt;div class="readme-overview"&gt;
    &lt;h2&gt;
      &lt;img src="https://assets.dev.to/assets/github-logo-5a155e1f9a670af7944dd5e12375bc76ed542ea80224905ecaf878b9157cdefc.svg" alt="GitHub logo"&gt;
      &lt;a href="https://github.com/neutralinojs" rel="noopener noreferrer"&gt;
        neutralinojs
      &lt;/a&gt; / &lt;a href="https://github.com/neutralinojs/neutralinojs-react" rel="noopener noreferrer"&gt;
        neutralinojs-react
      &lt;/a&gt;
    &lt;/h2&gt;
    &lt;h3&gt;
      React starter project for Neutralinojs
    &lt;/h3&gt;
  &lt;/div&gt;
&lt;/div&gt;


&lt;h1&gt;
  
  
  Comparison between legacy and new template
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;New template is more supporting component based structure than legacy template.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;While developing with the legacy, if you refresh the browser after a while you may see the “unable to connect” error but, with a new template you will never experience that issue. So while developing you can use the below command to avoid that and after the execution of the command you can open the app in browser mode, so you can have uninterrupted development experience.&lt;br&gt;
&lt;/p&gt;

&lt;p&gt;&lt;code&gt;npm start&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;In legacy ES6+ code needs to transpile to ES5 every time when application starts so it’s a bit slow.but with new template it transpile the code with support of webpack,when the application is built. so it’s not going to transpile the code at runtime.and code was also optimized with this method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;New template App folder size also became smaller than the legacy because it didn’t include the babel.js.just babel.js take 1888 Kb.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft0encj8labg79g37x41j.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ft0encj8labg79g37x41j.PNG" alt="App folder size comparison" width="344" height="74"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Legacy uses the older version of NeutralinoJs but New template uses the latest version(1.3.0).&lt;/li&gt;
&lt;li&gt;If you are going to use a version control system like Github .You can use an automated dependency update tool like dependabot to update react,babel..etc .But with legacy you can’t automate the process. because those react,react-dom,babel files are manually placed inside the App/assets folder.with the new template this was also fixed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  NeutralinoJs CLI
&lt;/h1&gt;

&lt;p&gt;You can easily create Neutralino applications with several pre-build templates. like a new Neutralino-react template there are other templates which you can tryout.&lt;/p&gt;

&lt;p&gt;you can refer to the NeutralinoJs &lt;a href="https://neutralino.js.org/docs/#/tools/cli" rel="noopener noreferrer"&gt;docs&lt;/a&gt; for more detailed examples for creating applications using Neu-CLI.also at the end of this post i am also going to tell you how to create Neutralino-react template using Neu-CLI.&lt;/p&gt;

&lt;p&gt;Let’s say you are not going to use Neu-CLI and the &lt;a href="https://github.com/neutralinojs/neutralinojs-react" rel="noopener noreferrer"&gt;Neutralino-react&lt;/a&gt; template to create you’r Neutralino-react project, then you have to spend some time configuring the project 😕 . so,it’s really easy to use neu-cli or template for you project rather than going through the configurations. 😎&lt;/p&gt;

&lt;h1&gt;
  
  
  How to create Neutralino-React project using Neu-CLI
&lt;/h1&gt;

&lt;p&gt;It’s really simple to create a new project using neu-cli.&lt;/p&gt;

&lt;p&gt;Open your terminal(cmd,terminal,git bash..etc) and cd into the location where you would like to create your project.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1&lt;/strong&gt; : &lt;em&gt;Let’s install Neu-cli&lt;/em&gt;&lt;br&gt;
           &lt;code&gt;npm i -g @neutralinojs/neu&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2&lt;/strong&gt; : * Let’s create the app.you can give any name for myapp*&lt;br&gt;
           &lt;code&gt;neu create myapp --template react&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3&lt;/strong&gt; : * Let’s cd into the project folder and build the app*&lt;br&gt;
           &lt;code&gt;cd myapp &amp;amp;&amp;amp; neu build&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;After successful build you will see this massage in the terminal&lt;/em&gt;&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F06hdrv05plaf0s8udbqa.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F06hdrv05plaf0s8udbqa.PNG" alt="Alt Text" width="494" height="120"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4&lt;/strong&gt; : &lt;em&gt;Let’s open NeutralinoJs executable file (open corresponding file for you OS)&lt;/em&gt;&lt;br&gt;
           &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxi4fuheyzrgzc53qoope.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxi4fuheyzrgzc53qoope.PNG" alt="Alt Text" width="608" height="341"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you do everything correctly when you open the executable file.you will see this&lt;/em&gt; 🚀&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk94jvst2d4rwycn7exos.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk94jvst2d4rwycn7exos.PNG" alt="Alt Text" width="800" height="470"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Okay, now you know how to create an application using Neu-React template. 😎&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This is my first article. I really hope you’ve liked this article and I am very keen on hearing your thoughts about it. Just give this article a comment and I’ll be more than happy to reply.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;ENJOY YOUR CODING!&lt;/em&gt; 🚀.&lt;/p&gt;

</description>
      <category>react</category>
      <category>neutralinojs</category>
    </item>
  </channel>
</rss>
