<?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>Forem: Navdeep Mishra</title>
    <description>The latest articles on Forem by Navdeep Mishra (@navdeepm20).</description>
    <link>https://forem.com/navdeepm20</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.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F534624%2F3e7f3f6b-a7ef-4e3d-b57b-03c968cd2b9e.jpg</url>
      <title>Forem: Navdeep Mishra</title>
      <link>https://forem.com/navdeepm20</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/navdeepm20"/>
    <language>en</language>
    <item>
      <title>How I Rendered Mermaid Diagrams in React (and Built a Library for It)</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Mon, 06 Oct 2025 16:08:09 +0000</pubDate>
      <link>https://forem.com/navdeepm20/how-i-rendered-mermaid-diagrams-in-react-and-built-a-library-for-it-c4d</link>
      <guid>https://forem.com/navdeepm20/how-i-rendered-mermaid-diagrams-in-react-and-built-a-library-for-it-c4d</guid>
      <description>&lt;p&gt;🧠 &lt;strong&gt;TL;DR&lt;/strong&gt; — &lt;em&gt;I couldn’t find a working React library for Mermaid diagrams, so I built my own — simple, typed, and customizable. Here’s how it works and how you can use it&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;1️⃣ &lt;strong&gt;The Problem: Rendering Mermaid in React is not smooth&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you’ve ever tried to render Mermaid diagrams inside a React app, you know the pain.&lt;br&gt;
Recently, I faced the same challenge — and realized most existing libraries either don’t work well or are abandoned.&lt;/p&gt;

&lt;p&gt;The current React-specific packages are either too old, poorly documented, or simply not working anymore.&lt;br&gt;
Sure, you can always use plain Mermaid.js directly — but that means writing a bunch of boilerplate setup code just to render a simple diagram.&lt;/p&gt;

&lt;p&gt;That’s extra work every time you want to add or update one.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What I Noticed While Researching.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Many libraries are outdated and unmaintained.&lt;/li&gt;
&lt;li&gt;Some break during render or don’t handle updates properly.&lt;/li&gt;
&lt;li&gt;Most have poor documentation and very few examples.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;All this slowed down my project — and sparked an idea:&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What if I build a React library that just works out of the box?&lt;/strong&gt; &lt;/p&gt;
&lt;h3&gt;
  
  
  Introducing My Library — Render Mermaid in React with Ease
&lt;/h3&gt;

&lt;p&gt;So I rolled up my sleeves and built a lightweight React library that lets you render Mermaid code with minimal setup.&lt;/p&gt;

&lt;p&gt;It supports two main approaches, depending on how you like to work:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Component-based Approach&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is the easiest way to get started.&lt;br&gt;
Just import and use the provided React component — no extra setup required.&lt;/p&gt;

&lt;p&gt;✅ Features:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Plug-and-play usage&lt;/li&gt;
&lt;li&gt;Fully typed props (TypeScript support)&lt;/li&gt;
&lt;li&gt;Customizable theme &amp;amp; style&lt;/li&gt;
&lt;li&gt;Built-in error states for syntax/render issues&lt;/li&gt;
&lt;li&gt;Copy-code + download-as-SVG support
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;RenderMermaid&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-x-mermaid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&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;d1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`
  graph TD;
  A--&amp;gt;B;
  A--&amp;gt;C;
  B--&amp;gt;D;
  C--&amp;gt;D;
`&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="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"app"&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;RenderMermaid&lt;/span&gt; &lt;span class="na"&gt;mermaidCode&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;d1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;mermaidConfig&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dark&lt;/span&gt;&lt;span class="dl"&gt;"&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;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;strong&gt;2. Hook-based Approach (For Advanced Use Cases)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you want full control, the library also provides a custom hook.&lt;br&gt;
It gives you access to the rendered SVG and state, so you can build your own UI around it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&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;useMermaid&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="s2"&gt;react-x-mermaid&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;AdvanceMermaidRenderer&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;chart&lt;/span&gt; &lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// hook also gives you svg along with ref and error which it generate which you can use to download and save locally if required&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useMermaid&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;chart&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;theme&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;dark&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// mermaid config&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// show error or render code in &amp;lt;pre&amp;gt; and &amp;lt;code&amp;gt; tags if you need as a fallback.&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mermaid__error"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;error&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;div&lt;/span&gt;&lt;span class="p"&gt;&amp;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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"mermaid-renderer"&lt;/span&gt; &lt;span class="na"&gt;ref&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;ref&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;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;AdvanceMermaidRenderer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✅ Perfect for:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Integrating Mermaid inside markdown renderers&lt;/li&gt;
&lt;li&gt;Custom toolbars, editors, or documentation apps&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🚀&lt;strong&gt;_ Why This Matters_&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you’re building documentation tools, internal dashboards, or markdown editors, Mermaid diagrams are incredibly useful for visualizing flows and systems.&lt;br&gt;
Having a reliable React wrapper saves hours of setup and debugging.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;🧠 Behind the Scenes&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Written in TypeScript&lt;/li&gt;
&lt;li&gt;Uses Mermaid v11+&lt;/li&gt;
&lt;li&gt;Handles async rendering and cleanup&lt;/li&gt;
&lt;li&gt;Tested across SSR and client-only setups&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;🙌 &lt;strong&gt;Try It Yourself&lt;/strong&gt;&lt;br&gt;
Install it in seconds:&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-x-mermaid mermaid
&lt;span class="c"&gt;# or&lt;/span&gt;
yarn add react-x-mermaid mermaid
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;Docs and examples&lt;/em&gt;&lt;/strong&gt;: &lt;a href="https://www.npmjs.com/package/react-x-mermaid" rel="noopener noreferrer"&gt;https://www.npmjs.com/package/react-x-mermaid&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;💬 Wrap-up&lt;/p&gt;

&lt;p&gt;If you’ve struggled to render Mermaid in React, this library should make it a breeze.&lt;br&gt;
Give it a try — and if you hit any edge cases, drop them in the comments.&lt;br&gt;
I’d love to see how you use it in your projects!&lt;/p&gt;

</description>
      <category>react</category>
      <category>mermaid</category>
      <category>vite</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Effortless JavaScript Retries with redo.js!</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Tue, 01 Apr 2025 08:09:11 +0000</pubDate>
      <link>https://forem.com/navdeepm20/effortless-javascript-retries-with-redojs-315d</link>
      <guid>https://forem.com/navdeepm20/effortless-javascript-retries-with-redojs-315d</guid>
      <description>&lt;h2&gt;
  
  
  Effortless JavaScript Retries with redo.js! 🚀
&lt;/h2&gt;

&lt;p&gt;Tired of handling unreliable APIs, flaky database queries, or network failures? Instead of writing complex retry logic, let redo.js handle it for you—simple, powerful, and effortless!&lt;/p&gt;

&lt;h3&gt;
  
  
  Why redo.js?
&lt;/h3&gt;

&lt;p&gt;✅ Works with Node.js, React, Vue, and more✅ Supports customizable retry strategies (exponential backoff, fixed delays, etc.)✅ Handles errors automatically with minimal code&lt;/p&gt;

&lt;p&gt;📦 &lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using npm:
&lt;/li&gt;
&lt;/ul&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;redo.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Using yarn:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add redo.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚡ &lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔄 &lt;strong&gt;Retry Synchronous Operations&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;retryOperation&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="s2"&gt;redo.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;retryOperation&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;retryCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default: 3 - Number of retry attempts&lt;/span&gt;
  &lt;span class="na"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default: 1000ms - Delay between retries&lt;/span&gt;
  &lt;span class="c1"&gt;// incrementalDelayFactor: 2, // Optional - Exponential backoff factor&lt;/span&gt;

  &lt;span class="na"&gt;retryCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Retrying operation...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation failed&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;onErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;onSuccessCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation succeeded!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;afterLastAttemptErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Final error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;strong&gt;Retry Asynchronous Operations&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;axios&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;retryAsyncOperation&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="s2"&gt;redo.js&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;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://jsonplaceholder.typicode.com/posts&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="nf"&gt;retryAsyncOperation&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;retryCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// incrementalDelayFactor: 2,&lt;/span&gt;

  &lt;span class="na"&gt;retryAsyncCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &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;await&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;onErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentRetryCount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Retry #&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;currentRetryCount&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; failed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;onSuccessCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation succeeded with status:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;afterLastAttemptErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Final error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;🚀 Try redo.js today and make your async workflows resilient!&lt;/p&gt;

&lt;p&gt;🔄 Like, share, and support! 😊&lt;/p&gt;

&lt;p&gt;Thank you! 🙌&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Effortless JavaScript Retries with redo.js!</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Mon, 31 Mar 2025 18:17:01 +0000</pubDate>
      <link>https://forem.com/navdeepm20/effortless-javascript-retries-with-redojs-29k</link>
      <guid>https://forem.com/navdeepm20/effortless-javascript-retries-with-redojs-29k</guid>
      <description>&lt;h2&gt;
  
  
  Effortless JavaScript Retries with redo.js! 🚀
&lt;/h2&gt;

&lt;p&gt;Tired of handling unreliable APIs, flaky database queries, or network failures? Instead of writing complex retry logic, let redo.js handle it for you—simple, powerful, and effortless!&lt;/p&gt;

&lt;h3&gt;
  
  
  Why redo.js?
&lt;/h3&gt;

&lt;p&gt;✅ Works with Node.js, React, Vue, and more✅ Supports customizable retry strategies (exponential backoff, fixed delays, etc.)✅ Handles errors automatically with minimal code&lt;/p&gt;

&lt;p&gt;📦 &lt;strong&gt;Installation&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Using npm:
&lt;/li&gt;
&lt;/ul&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;redo.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Using yarn:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn add redo.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚡ &lt;strong&gt;Usage&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;🔄 &lt;strong&gt;Retry Synchronous Operations&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;retryOperation&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="s2"&gt;redo.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="nf"&gt;retryOperation&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;retryCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default: 3 - Number of retry attempts&lt;/span&gt;
  &lt;span class="na"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Default: 1000ms - Delay between retries&lt;/span&gt;
  &lt;span class="c1"&gt;// incrementalDelayFactor: 2, // Optional - Exponential backoff factor&lt;/span&gt;

  &lt;span class="na"&gt;retryCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Retrying operation...&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation failed&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;onErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;An error occurred.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;onSuccessCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation succeeded!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;afterLastAttemptErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Final error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;strong&gt;Retry Asynchronous Operations&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;axios&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;retryAsyncOperation&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="s2"&gt;redo.js&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;fetchData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;axios&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;https://jsonplaceholder.typicode.com/posts&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="nf"&gt;retryAsyncOperation&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;retryCount&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;retryDelay&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="c1"&gt;// incrementalDelayFactor: 2,&lt;/span&gt;

  &lt;span class="na"&gt;retryAsyncCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;async &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;await&lt;/span&gt; &lt;span class="nf"&gt;fetchData&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt;
  &lt;span class="na"&gt;onErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;currentRetryCount&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`Retry #&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;currentRetryCount&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; failed: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;onSuccessCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Operation succeeded with status:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;response&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;status&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;afterLastAttemptErrorCallback&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;error&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Final error:&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&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;🚀 Try redo.js today and make your async workflows resilient!&lt;/p&gt;

&lt;p&gt;🔄 Like, share, and support! 😊&lt;/p&gt;

&lt;p&gt;Thank you! 🙌&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>redojs</category>
      <category>retryjs</category>
      <category>react</category>
    </item>
    <item>
      <title>Spoiler Alert: Import Alias in React + Vite</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Fri, 01 Mar 2024 14:33:35 +0000</pubDate>
      <link>https://forem.com/navdeepm20/spoiler-alert-import-alias-in-react-vite-3apf</link>
      <guid>https://forem.com/navdeepm20/spoiler-alert-import-alias-in-react-vite-3apf</guid>
      <description>&lt;p&gt;Today in this short article let's quickly learn how to set up path aliases in your React application. Avoid boring long imports in your app and start using path aliases now.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pre-requisites&lt;/strong&gt;&lt;br&gt;
Must have a React app with vite. If you are still using CRA, checkout my guide to migrate your app to vite.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;For Javascript Projects&lt;/strong&gt; &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Update your vite config&lt;/strong&gt;
You have to update your vite config to make your aliases work.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Paste the following contents -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;defineConfig&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="s2"&gt;vite&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="nx"&gt;react&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@vitejs/plugin-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="nx"&gt;path&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;alias&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@components&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/components&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@pages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/pages&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@forms&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/forms&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@utils&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/utils&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@providers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/providers&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
      &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@assets&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;./src/assets&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="p"&gt;},&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;react&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;You can add your own folder according to your need. Likes &lt;code&gt;hooks&lt;/code&gt;,&lt;code&gt;context&lt;/code&gt; and etc.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;For Javascript/Typescript project&lt;/em&gt;, create a &lt;code&gt;jsconfig.json&lt;/code&gt; or  &lt;code&gt;tsconfig.json&lt;/code&gt; (For Typescript Project) file in the root of your project. This step is necessary to make sure vs code intellisense works properly.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Paste the following contents -&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"compilerOptions"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"baseUrl"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"."&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="nl"&gt;"paths"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@components/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/components/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@pages/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/pages/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@assets/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/assets/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@forms/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/forms/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@providers/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/providers/*"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;&lt;span class="w"&gt;
      &lt;/span&gt;&lt;span class="nl"&gt;"@utils/*"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="s2"&gt;"./src/utils/*"&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="w"&gt;
    &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;

&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This file will help your code editor intellisense to recommend you the path aliases during import.&lt;/p&gt;

&lt;p&gt;That's all, now you can import a component like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;MyComponent&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@components/MyComponent&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Thank you for reading this article. 💓&lt;br&gt;
Please share and follow for more dev content. 😄&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Webpack Killed Again 😢: Guide to Migrate Electron Forge Webpack Project to Vite</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Sun, 24 Dec 2023 07:52:34 +0000</pubDate>
      <link>https://forem.com/navdeepm20/i-killed-electro-with-webpack-guide-to-migrate-electron-forge-webpack-to-vite-3nek</link>
      <guid>https://forem.com/navdeepm20/i-killed-electro-with-webpack-guide-to-migrate-electron-forge-webpack-to-vite-3nek</guid>
      <description>&lt;p&gt;In this blog post, I'll take you through the steps I took to bid farewell to Webpack and welcome Vite into the world of Electron Forge. You'll find this guide incredibly beneficial if you're looking to streamline your development process, leverage Vite's lightning-fast bundling, and make your Electron app development smoother than ever before.&lt;/p&gt;

&lt;p&gt;So Let's get started...&lt;/p&gt;

&lt;p&gt;I assume that you are already having the a project running on &lt;code&gt;Electron Forge Webpack Template&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;If you don't know what is Electron Forge and why you should use it. Check out this link -&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.electronforge.io/core-concepts/why-electron-forge" rel="noopener noreferrer"&gt;https://www.electronforge.io/core-concepts/why-electron-forge&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you want to migrate to an existing Electron App to Electron Forge, then checkout this link. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.electronforge.io/import-existing-project" rel="noopener noreferrer"&gt;https://www.electronforge.io/import-existing-project&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;So, Now I assume that you are having already having a project running on Electron Forge with Webpack template. When I first started using Electron Forge, there was not Vite template. So I use the webpack one.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Problem -&lt;/strong&gt; 😑&lt;/p&gt;

&lt;p&gt;The webpack is no doubt a good old trusted bundler but when it comes to startup times and bundling, it's slow. Also if you are using frameworks like Vue or Lib's like React, Then it becomes more slow in bundling those assets.&lt;br&gt;
Whereas, Vite is very fast in this and also Vite is gaining popularity everyday due to it's features. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Simple Solution&lt;/strong&gt; 🙂&lt;br&gt;
Electron Forge team has introduced the Vite template now and you can create a Electron Project with Vite as a tooling and bundling.&lt;br&gt;
That's good right? Yeah, It's superb.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Again There is a problem&lt;/strong&gt; 🫡&lt;/p&gt;

&lt;p&gt;I don't know why but I found sometimes the Electron Forge document is not accurate which create issues. Right now there is no proper migration Guide. The is lack of information in migrating a new project. Current Document is about the Vite plugin &lt;a href="https://www.electronforge.io/config/plugins/vite" rel="noopener noreferrer"&gt;https://www.electronforge.io/config/plugins/vite&lt;/a&gt;&lt;br&gt;
but it's not enough for migrating the project.&lt;/p&gt;

&lt;p&gt;I also faced the issues in migrating my existing project. I though let's figure it out and share it with my folks. 😎&lt;/p&gt;

&lt;p&gt;Let's Get started now ... &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;First of all we have to install the Vite plugin for Electron Forge&lt;/li&gt;
&lt;/ul&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; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; @electron-forge/plugin-vite
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now create three files in your root folder just in the same level as your &lt;code&gt;src&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;vite.main.config.js&lt;/code&gt; or &lt;code&gt;.ts&lt;/code&gt; &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;defineConfig&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="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;resolve&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Some libs that can run in both Web and Node.js, such as `axios`, we need to tell Vite to build them in Node.js.&lt;/span&gt;
    &lt;span class="na"&gt;browserField&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;conditions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;node&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;mainFields&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;module&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;jsnext:main&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;jsnext&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="p"&gt;});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;code&gt;vite.preload.config.js&lt;/code&gt; or &lt;code&gt;.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;defineConfig&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="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&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;vite.renderer.config.js&lt;/code&gt; or &lt;code&gt;.ts&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&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;defineConfig&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="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// https://vitejs.dev/config&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({});&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Now move your &lt;code&gt;index.html&lt;/code&gt; from &lt;code&gt;src&lt;/code&gt; to the root of the project. And paste the following lines - &lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;meta&lt;/span&gt; &lt;span class="na"&gt;charset=&lt;/span&gt;&lt;span class="s"&gt;"UTF-8"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;Hello World!&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;💖 Hello World!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Welcome to your Electron application.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;script &lt;/span&gt;&lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"module"&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"./src/renderer.js"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Update your &lt;code&gt;forge.config.js&lt;/code&gt; 
``&lt;code&gt;js
module.exports = {
packagerConfig: {},
rebuildConfig: {},
makers: [
{
  name: "@electron-forge/maker-squirrel",
  config: {},
},
{
  name: "@electron-forge/maker-zip",
  platforms: ["darwin"],
},
{
  name: "@electron-forge/maker-deb",
  config: {},
},
{
  name: "@electron-forge/maker-rpm",
  config: {},
},
],
plugins: [
{
  name: "@electron-forge/plugin-vite",
  config: {
    //&lt;/code&gt;build&lt;code&gt;can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
    // If you are familiar with Vite configuration, it will look really familiar.
    build: [
      {
        //&lt;/code&gt;entry&lt;code&gt;is just an alias for&lt;/code&gt;build.lib.entry&lt;code&gt;in the corresponding file of&lt;/code&gt;config`.
        entry: "src/main.js",
        config: "vite.main.config.js",
      },
      {
        entry: "src/preload.js",
        config: "vite.preload.config.js",
      },
    ],
    renderer: [
      {
        name: "main_window",
        config: "vite.renderer.config.js",
      },
    ],
  },
},
],
};&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Update your `package.json` main entry from webpack to Vite.

```json
  "main": ".vite/build/main.js",
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;Final step is to update our &lt;code&gt;main.js&lt;/code&gt; with &lt;code&gt;Vite&lt;/code&gt; specific variables to load our app. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;code&gt;main.js&lt;/code&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;BrowserWindow&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;electron&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;path&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;path&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Handle creating/removing shortcuts on Windows when installing/uninstalling.&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;require&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;electron-squirrel-startup&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;quit&lt;/span&gt;&lt;span class="p"&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;createWindow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Create the browser window.&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;mainWindow&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;BrowserWindow&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;800&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;600&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;webPreferences&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;preload&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;preload.js&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="p"&gt;});&lt;/span&gt;

  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MAIN_WINDOW_VITE_DEV_SERVER_URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="c1"&gt;// and load the index.html of the app.&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MAIN_WINDOW_VITE_DEV_SERVER_URL&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;mainWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loadURL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MAIN_WINDOW_VITE_DEV_SERVER_URL&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;mainWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;loadFile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="nx"&gt;path&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;__dirname&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s2"&gt;`../renderer/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;MAIN_WINDOW_VITE_NAME&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;/index.html`&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="c1"&gt;// Open the DevTools.&lt;/span&gt;
  &lt;span class="nx"&gt;mainWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;webContents&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;openDevTools&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="c1"&gt;// This method will be called when Electron has finished&lt;/span&gt;
&lt;span class="c1"&gt;// initialization and is ready to create browser windows.&lt;/span&gt;
&lt;span class="c1"&gt;// Some APIs can only be used after this event occurs.&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;ready&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;createWindow&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Quit when all windows are closed, except on macOS. There, it's common&lt;/span&gt;
&lt;span class="c1"&gt;// for applications and their menu bar to stay active until the user quits&lt;/span&gt;
&lt;span class="c1"&gt;// explicitly with Cmd + Q.&lt;/span&gt;
&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;window-all-closed&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;platform&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;darwin&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="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;quit&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="nx"&gt;app&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;activate&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// On OS X it's common to re-create a window in the app when the&lt;/span&gt;
  &lt;span class="c1"&gt;// dock icon is clicked and there are no other windows open.&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BrowserWindow&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getAllWindows&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;createWindow&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// In this file you can include the rest of your app's specific main process&lt;/span&gt;
&lt;span class="c1"&gt;// code. You can also put them in separate files and import them here.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;That's it. I know little long but worth doing. &lt;/p&gt;

&lt;p&gt;Now final step is to run our app and see &lt;code&gt;Vite&lt;/code&gt; in action.&lt;/p&gt;

&lt;p&gt;Run &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;yarn start
&lt;span class="c"&gt;# if using npm&lt;/span&gt;
&lt;span class="c"&gt;# npm start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fyha044h4vk1or97f49ev.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fyha044h4vk1or97f49ev.png" alt="Electron App Image"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;That's it...Enjoy Vite with your existing Electron App&lt;/em&gt; 😎&lt;/p&gt;

&lt;p&gt;If you have any issues, Let me know in the comment section. I would be happy to answer them all.&lt;/p&gt;

&lt;p&gt;Save it for future and Like 👍 and Follow 👈 for more content. ✨&lt;/p&gt;

</description>
      <category>electron</category>
      <category>vite</category>
      <category>react</category>
      <category>webpack</category>
    </item>
    <item>
      <title>ECMAScript 2023: Fresh Goodies for JavaScript Developers</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Sun, 17 Dec 2023 12:56:11 +0000</pubDate>
      <link>https://forem.com/navdeepm20/dive-into-ecmascript-2023-fresh-goodies-for-javascript-developers-1dda</link>
      <guid>https://forem.com/navdeepm20/dive-into-ecmascript-2023-fresh-goodies-for-javascript-developers-1dda</guid>
      <description>&lt;p&gt;Greetings, fellow code warriors! ⚔️ The JavaScript landscape is constantly evolving, and with the arrival of ECMAScript 2023 (ES14) in June 2023, we've got a new batch of tools to craft even more powerful and elegant applications.  Let's explore some of the coolest features and unleash their potential in your code!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;1. Array Enhancements: Supercharge your data wrangling. All these new methods are called &lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array#copying_methods_and_mutating_methods" rel="noopener noreferrer"&gt;copying&lt;/a&gt; methods. They return a new array instead of modifying the actual array.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;toReversed&lt;/code&gt;: Say goodbye to .reverse() loops! This method lets you flip your arrays with a single, readable line:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reversedNumbers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;numbers&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toReversed&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// [2, 4, 1, 3]&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;toSorted&lt;/code&gt;: Taming unruly data becomes a breeze. Sort your arrays in natural order. The toSorted() method of Array instances is the copying version of the &lt;code&gt;sort()&lt;/code&gt; method. It returns a new array with the elements sorted in ascending order. You can also pass a compare function just like our good old &lt;code&gt;sort&lt;/code&gt; method.&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;mango&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;kiwi&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;sortedFruits&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;fruits&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toSorted&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ["apple", "banana", "kiwi", "mango"]&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;toSpliced&lt;/code&gt;: Need precise surgical edits? toSpliced adds or removes elements at specific indexes:&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;letters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;a&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;c&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;d&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;e&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;editedLetters&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;letters&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;toSpliced&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="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;x&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;y&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ["a", "b", "x", "y", "d", "e"]&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;2. Symbols as WeakMap Keys: Unleash memory magic&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;WeakMaps hold references to objects without preventing garbage collection. Now, you can use symbols as keys, making your code even more memory-efficient!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;symbolKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Symbol&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;MySecretId&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;weakMap&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;WeakMap&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="nx"&gt;weakMap&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;set&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;symbolKey&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Reference held without keeping element alive&lt;/span&gt;

&lt;span class="c1"&gt;// ... later, symbolKey can still access the element&lt;/span&gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;3. Hashbang Standardization: Say hello to portable scripts&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Shebang lines (#!) in your JavaScript files now have a standardized grammar, making them consistent and easier to run across different environments. No more confusion!&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="cp"&gt;

#!/usr/bin/env node
&lt;/span&gt;&lt;span class="c1"&gt;// Your amazing JavaScript code goes here&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;4. Private Class Members (Stage 3): A peek into the future&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;While still under development, private class fields and methods promise to revolutionize code organization and data encapsulation. Get ready for cleaner, more secure classes!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Bonus Goodies:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Improved type inference for object literals simplifies and clarifies your code.&lt;br&gt;
New &lt;code&gt;BigInt asDate&lt;/code&gt; and &lt;code&gt;BigInt asTime&lt;/code&gt; functions let you work with large time values effortlessly.&lt;br&gt;
Stricter error handling in async functions makes debugging smoother.&lt;br&gt;
&lt;code&gt;Promise.prototype.finally&lt;/code&gt; provides a concise way to run code after any Promise outcome.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Remember: These are just a taste of the exciting possibilities in ES14. Explore the full spec and experiment with these features to take your JavaScript skills to the next level!&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Share your favorite new ES14 feature in the comments below! Let's discuss how we can leverage these tools to build even better web experiences.&lt;/em&gt; 😎&lt;/p&gt;

&lt;p&gt;And don't forget, the journey of learning never ends! Stay curious, stay code-hungry, and keep building amazing things!&lt;/p&gt;

&lt;p&gt;Follow for more content 💓&lt;/p&gt;

</description>
      <category>ecmascript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Store your notes in your browser 😎🔥</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Sun, 15 Oct 2023 17:16:36 +0000</pubDate>
      <link>https://forem.com/navdeepm20/store-your-notes-in-your-browser-304m</link>
      <guid>https://forem.com/navdeepm20/store-your-notes-in-your-browser-304m</guid>
      <description>&lt;p&gt;Hi Dev's, Today I'll be sharing one of my starter projects when I was learning web development. The one of the most useful tool for everyone which is a Notes app. We all want to store our notes so I just wanted to create a notes app without any backend just frontend. &lt;/p&gt;

&lt;p&gt;Interesting.... hmm...&lt;/p&gt;

&lt;p&gt;It now more than 3 years I guess, that time I didn't knew the backend and was just exploring the frontend. Although there are several notes apps, but as a developer I wanted to learn the process and then I thought to create a mini project on this.&lt;/p&gt;

&lt;p&gt;This stores your notes on your browser which is completely local, Offers a nice clean UI, Edit &amp;amp; Delete option and other handy features. &lt;/p&gt;

&lt;p&gt;3 years back, That day, I opened my VS Code and created this. &lt;a href="https://notefizz.netlify.app/" rel="noopener noreferrer"&gt;NoteFizz&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is completely mobile friendly as well so you can use it from your mobile browser.&lt;/p&gt;

&lt;p&gt;Just Try it out and rate it. What you guys think how it could more useful. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Ft718f3sjdd9u9oglihl5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Ft718f3sjdd9u9oglihl5.png" alt="NoteFizz desktop image" width="800" height="385"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fn49gq4lg6x1ziagnrnhf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fn49gq4lg6x1ziagnrnhf.png" alt="NoteFizz mobile image" width="362" height="739"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Let me know in the comments, if any Ideas and suggestions you have. 😎&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>html</category>
      <category>css</category>
    </item>
    <item>
      <title>Silly Git Mistakes! Fixing Author name in git history</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Thu, 05 Oct 2023 18:51:03 +0000</pubDate>
      <link>https://forem.com/navdeepm20/silly-git-mistakes-resetting-author-name-in-git-history-1ffk</link>
      <guid>https://forem.com/navdeepm20/silly-git-mistakes-resetting-author-name-in-git-history-1ffk</guid>
      <description>&lt;p&gt;Your Git commit history is not only a record of your project's progress but also a reflection of the individuals who contributed to its development. However, there are times when you may need to correct or update author information for multiple commits. Whether it's fixing a typo in your email address or ensuring your commits are properly attributed, Git provides powerful tools for reshaping your commit history. 😎&lt;/p&gt;

&lt;p&gt;In this blog post, I will explore an essential Git task that every developer should know: changing the author information for all commits in your repository. We'll dive into the process step by step, covering both classic and modern methods, and provide tips on best practices to avoid common pitfalls. 😉&lt;/p&gt;

&lt;p&gt;Join me on this journey to unlock the full potential of your Git history, as we unveil the secrets to seamlessly updating author details for all your commits. Let's dive in!&lt;/p&gt;

&lt;p&gt;When you are working with git and using &lt;code&gt;Github&lt;/code&gt; may of you may have encountered a condition when you noticed that you pushed a commit to master branch but still you commit in not showing in your contributions graph. That time every dev's reaction.....&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fhsib634q4w06x18yox97.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fhsib634q4w06x18yox97.gif" alt="Frustrated Developer" width="360" height="200"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Very common mistake which developer do is setting the wrong username and email in the &lt;code&gt;git config&lt;/code&gt;&lt;br&gt;
Now if you don't remember what's this then it's the very first step you do when you start working with git by setting the username and email in your git config. 😯&lt;/p&gt;

&lt;p&gt;Now, This is very common when you are working with two different git accounts (work and personal) and set username and email globally using &lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

$ git config --global user.name "John Doe"
$ git config --global user.email johndoe@example.com


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Before jumping into the solution let's know how to avoid this thing in future if you haven't faced this issue.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Avoid working with different git account in same PC.&lt;/li&gt;
&lt;li&gt;Type you email and username correctly when setting &lt;code&gt;git config&lt;/code&gt; value.&lt;/li&gt;
&lt;li&gt;Avoid setting username and email globally and instead set it locally
```
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;$ git config --local user.name "John Doe"&lt;br&gt;
$ git config --local user.email &lt;a href="mailto:johndoe@example.com"&gt;johndoe@example.com&lt;/a&gt;&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
**Now if already did the mistake then.........**

![How do we fix this](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6ozzeycv1qdcpkw4q4n8.gif)

**Relax............**

![Relax](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/i15ht0vvwww53plmltr6.gif)


![I have solution](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qn9x6w1cdx6m3qz3wgz3.gif)


**_But before proceeding to solution. _**
_Warning: Changing commit information for all commits in your repository will rewrite the entire commit history, and it can be very disruptive if you're working in a shared repository. Make sure you have a good reason to do this, and communicate with your team before proceeding.
Do at your own risk._


**_There are two way of doing this._**

1. Git Filter Branch (Less Risky)
2. Git Rebase (Risky sometimes)


&amp;gt; **_Git Filter Branch (Less Risky)_**

For future use as well and doing in multiple repos I recommend creating a script which you can use in any repo and save it somewhere easily.

- If you want to change all commits author 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  !/bin/sh
&lt;/h1&gt;

&lt;p&gt;git filter-branch --env-filter '&lt;br&gt;
  export GIT_AUTHOR_NAME="New Author Name";&lt;br&gt;
  export GIT_AUTHOR_EMAIL="&lt;a href="mailto:new.email@example.com"&gt;new.email@example.com&lt;/a&gt;";&lt;br&gt;
  export GIT_COMMITTER_NAME="New Author Name";&lt;br&gt;
  export GIT_COMMITTER_EMAIL="&lt;a href="mailto:new.email@example.com"&gt;new.email@example.com&lt;/a&gt;";&lt;br&gt;
' -- --all&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- You want to change only specific ones
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git filter-branch --env-filter '&lt;br&gt;
  OLD_EMAIL="&lt;a href="mailto:old@email.com"&gt;old@email.com&lt;/a&gt;"&lt;br&gt;
  NEW_EMAIL="&lt;a href="mailto:new@email.com"&gt;new@email.com&lt;/a&gt;"&lt;br&gt;
  NEW_NAME="John Doe"&lt;/p&gt;

&lt;p&gt;if test "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL"&lt;br&gt;
  then&lt;br&gt;
    GIT_AUTHOR_EMAIL=$NEW_EMAIL&lt;br&gt;
    GIT_AUTHOR_NAME=$NEW_NAME&lt;br&gt;
  fi&lt;/p&gt;

&lt;p&gt;if test "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL"&lt;br&gt;
  then&lt;br&gt;
    GIT_COMMITTER_EMAIL=$NEW_EMAIL&lt;br&gt;
    GIT_COMMITTER_NAME=$NEW_NAME&lt;br&gt;
  fi&lt;br&gt;
' -- --all&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Make sure to change your name and email to the correct ones.

After that make the script executable.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;chmod +x update_author_info.sh&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Now just run the script

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;./update_author_info.sh&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Force-push the rewritten branch to update the remote repository:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git push origin --all --force&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt; Git Rebase (Risky sometimes)

- The first step is to identify the commits that you want to modify. You can do this by using the git log command, which displays the commit history of your repository.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git log&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;It should show the information like this 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;commit 5e3f7ba5d4249f5c06a4e5f4b3d1e7f7d6d1b917&lt;br&gt;
Author: John Smith &lt;a href="mailto:john@example.com"&gt;john@example.com&lt;/a&gt;&lt;br&gt;
Date:   Tue Jun 1 12:34:56 2021 -0500&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Add new feature
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;commit 2a7b9a1e9f6d7b5c8a3a714d61f6d7e1e0b8a6c2&lt;br&gt;
Author: Jane Doe &lt;a href="mailto:jane@example.com"&gt;jane@example.com&lt;/a&gt;&lt;br&gt;
Date:   Mon May 31 11:22:33 2021 -0500&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Fix bug
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;commit 8c8e1b4d2b4a2d4f4a4e4f4d6b6c6f0d8c8e8b2d&lt;br&gt;
Author: John Smith &lt;a href="mailto:john@example.com"&gt;john@example.com&lt;/a&gt;&lt;br&gt;
Date:   Sun May 30 10:11:12 2021 -0500&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Initial commit
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Start an Interactive Rebase

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git rebase -i HEAD~3&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;This command tells Git to start an interactive rebase from the current HEAD (the latest commit) up to three commits back. You can adjust the number to include more or fewer commits, depending on your needs.

After running this command, Git will open a text editor with a list of all the commits that you want to modify. Each commit is listed with a hash code, the author name and email, the commit date, and the commit message.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;pick 8c8e1b4 Initial commit&lt;br&gt;
pick 2a7b9a1 Fix bug&lt;br&gt;
pick 5e3f7ba Add new feature&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Now it’s time to edit the commits. For each commit that you want to modify, change the pick command to edit.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;edit 8c8e1b4 Initial commit&lt;br&gt;
pick 2a7b9a1 Fix bug&lt;br&gt;
edit 5e3f7ba Add new feature&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Save and close the file to continue

- _Modify the Author and Committer Information_

After saving and closing the file, Git will begin the interactive rebase. When it reaches the first commit that you want to modify, it will pause and allow you to make changes.

To modify the author and committer information, use the following commands:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git commit --amend --author="New Author Name &lt;a href="mailto:new-email@example.com"&gt;new-email@example.com&lt;/a&gt;" --no-edit&lt;br&gt;
git commit --amend --reset-author --no-edit&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Replace New Author Name and new-email@example.com with the new name and email address that you want to use.

The first command modifies the author information of the commit, while the second command modifies the committer information. The --no-edit option tells Git not to open the commit message editor.

Once you have made your changes, use the following command to continue the rebase:

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git rebase --continue&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- _Finish the Rebase_


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git rebase --continue&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- _Push the Changes_


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;git push --force&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
This command tells Git to force push the modified commits to the remote repository, overwriting the existing commits. Be careful when using git push --force as it can cause data loss if used incorrectly.

Source - [Check Here ](https://saturncloud.io/blog/how-to-change-the-author-and-committer-name-and-email-of-multiple-commits-in-git/)



![Now Chill](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/zye6wfpq8sbxe5khyqoy.gif)





Thankyou for reading. 💓
Please like, share, and follow for more dev content. 😉






&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>git</category>
      <category>github</category>
      <category>developer</category>
      <category>beginners</category>
    </item>
    <item>
      <title>3 State Switches are not tough - Ultimate guide to CSS Switches using CSS only</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Wed, 20 Sep 2023 17:36:18 +0000</pubDate>
      <link>https://forem.com/navdeepm20/3-state-switches-are-not-tough-ultimate-guide-to-css-switches-using-css-only-1gja</link>
      <guid>https://forem.com/navdeepm20/3-state-switches-are-not-tough-ultimate-guide-to-css-switches-using-css-only-1gja</guid>
      <description>&lt;p&gt;Hi there, when it comes to switches most people look for modern libraries but building core is very important.&lt;br&gt;
Creating switches are very easy. Today I will be sharing the guide to create CSS switches.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;We'll be seeing -&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;2 state switches&lt;/li&gt;
&lt;li&gt;2 state switches with custom icons.&lt;/li&gt;
&lt;li&gt;3 state switches&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2 State Switches&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;For creating switches you need a way to figure out the active states. If you are using JavaScript then there are lot of ways you can do it by dynamically adding classes on click. When it comes to css we have one very popular way which is by using the input type checkbox. Which changes it's state and you can target that state easily with CSS only. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Check the below html structure -&lt;/em&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;div class="switch1-container"&amp;gt;
      &amp;lt;h5&amp;gt; Simple two state switch&amp;lt;/h5&amp;gt;
      &amp;lt;div class="switch1"&amp;gt;
        &amp;lt;input type="checkbox" id="switch1-input"/&amp;gt;
        &amp;lt;label for="switch1-input"&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;span class="switch-bg"&amp;gt;&amp;lt;/switch&amp;gt;
      &amp;lt;/div&amp;gt;
&amp;lt;/div&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;em&gt;Note - Here in this html structure for giving the bg to the switch I experimented with a separate span and used absolute positioning. You can achieve the similar behavior using the ::before pseudo element.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Main thing to know here is that for getting the on status for the switch we can use the checked state of the input element.&lt;br&gt;
You can easily get it on input using &lt;code&gt;:checked&lt;/code&gt; pseudo class.&lt;/p&gt;

&lt;p&gt;For styling the CSS switch button we have to make use of the input label. The good thing is when you click on the label then input states gets toggled. So hide the input and design the label with good looking round circle.&lt;/p&gt;

&lt;p&gt;Once you designed the b and the circle now for moving the circle with the bg to give feel like a switch. Make use of &lt;code&gt;transform&lt;/code&gt; property. Use &lt;code&gt;translateX&lt;/code&gt; to move the circle and add &lt;code&gt;transition&lt;/code&gt; on &lt;code&gt;transform&lt;/code&gt; to make it smooth. 🙃&lt;/p&gt;

&lt;p&gt;That's it &lt;br&gt;
Your switch is ready. 🫡&lt;/p&gt;

&lt;p&gt;Checkout the Css below to understand what we discussed. &lt;br&gt;
Practical knowledge is more important you know.😎&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

*{
  margin:0;
  padding:0;
}
*,*::before,*::after{
  box-sizing:border-box;
}

:root{
    --clr-primary: #d9d9d9;
  --clr-secondary:#fafafa;
  --clr-clear:#ffffff;
  --clr-grey: #6d6d6d;
  --clr-dark:#1e1e1e;
  --ff-base:'Inter', sans-serif;
  --fw-regular: 400;
  --fs-200:0.875rem;
  --fs-300:1rem;
  --fs-400:1.125rem;
  --fs-500:1.375rem;
  --fs-600:1.75rem;
  --fs-700:3.25rem;

}
html{
  color-scheme: dark;
}
body{
  font-family: var(--ff-base);
  font-size: var(--fs-300);
  font-weight: var(--fw-regular);
}

.container{
  max-width:80%;
  margin: auto;
  height:100dvh;
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(200px,1fr));
/*   justify-content:center; */
  padding: 4rem;
}

input{
  display:none;
  cursor: pointer;
}
label{
  cursor: pointer;
}

.switch1-container h5{
  margin-bottom: 1rem;
}
.switch1{
  position:relative;
  border-radius: 30px;
  width:6rem;
  height:2.5rem;
  background: #ccc;
  display:flex;
  align-items:center;
  transition: .3s background-color ease;
}
.switch-bg{
  background-color: #eceeef;
  position:absolute;
  top:4px;
  left:5px;
  width:90%;
  height:80%;
  border-radius:30px;
  transition: background-color .2s ease-out;
}


.switch1 label {
  background-color:white;
  border: 1px solid #bbb;
  display:inline-block;
  width:24px;
  height:24px;
  border-radius:50%;
  display:inline-block;
  vertical-align:bottom;
  margin:5px 8px;
  z-index:2;
  transition: transform .3s ease;

}
.switch1 input:checked + label{
  transform: translateX(56px);
}
.switch1 input:checked + label + .switch-bg {
  background-color: dodgerblue;
}



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;2 State Switches with Custom Icon&lt;/strong&gt;&lt;br&gt;
For adding the icon to your switches is very easy you can use various way of doing that. &lt;strong&gt;I picked it using css only even no extra Html.&lt;/strong&gt; I used fontawesome for directly using icons in the stylesheet. The one I created is useful when you want to toggle between dark and night mode. 😎&lt;/p&gt;

&lt;p&gt;Just add this to your styles sheet and in Html file.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Html&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;div class="switch2-container"&amp;gt;
      &amp;lt;h5&amp;gt; Simple two state siwtch with custom icon&amp;lt;/h5&amp;gt;
      &amp;lt;div class="switch2"&amp;gt;
        &amp;lt;input type="checkbox" id="switch2-input"/&amp;gt;
        &amp;lt;label for="switch2-input"&amp;gt;&amp;lt;/label&amp;gt;
        &amp;lt;span class="switch-bg"&amp;gt;&amp;lt;/switch&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;Css&lt;/strong&gt;&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;


.switch2-container h5{
  margin-bottom: 1rem;
}
.switch2{
  position:relative;
  border-radius: 30px;
  width:6rem;
  height:2.5rem;
  background: #ccc;
  display:flex;
  align-items:center;
  transition: .3s background-color ease;
}
.switch2-bg{
  background-color: #eceeef;
  position:absolute;
  top:4px;
  left:5px;
  width:90%;
  height:80%;
  border-radius:30px;
  transition: background-color .2s ease-out;
}


.switch2 label {
/*   background-color:white; */
/*   border: 1px solid #bbb; */
  display:inline-block;
  width:24px;
  height:24px;
  border-radius:50%;
  display:inline-block;
  vertical-align:bottom;
  margin:3px 8px 0px;
  z-index:2;
  transition: transform .3s ease;

}
.switch2 input:checked + label{
  transform: translateX(56px);
}
.switch2 input:checked + label + .switch-bg {
  background-color: dodgerblue;
}

.switch2 label::before{
  font: var(--fa-font-solid);
  content: "\f185";
  color: gold;
  font-size: 1rem;
  border: 1px solid #ccc;
  border-radius: 50%;
  padding: 4px;
}
.switch2 input:checked + label::before{
  content: "\f186";
  color:gold;
  border: none;
}
.switch2 input:checked + label + .switch-bg{
  background: black;
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;Now the third one is the powerful one.&lt;/em&gt;&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;&lt;em&gt;3 State Switches&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fdfknq5keo1r2xd7manq7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fdfknq5keo1r2xd7manq7.gif" alt="The godfather"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For this one I use input type &lt;code&gt;radios&lt;/code&gt; because of one good behavior that when you have radio group and each has same name attribute then if you select one then the other one will be de-selected automatically.&lt;/p&gt;

&lt;p&gt;I created my html structure like this.&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

 &amp;lt;div class="switch3-container"&amp;gt;
      &amp;lt;h5&amp;gt; Simple three state siwtch&amp;lt;/h5&amp;gt;
      &amp;lt;div class="switch3"&amp;gt;
        &amp;lt;input type="radio" id="switch3-radio1" name="radio"/&amp;gt;
        &amp;lt;label for="switch3-radio1"&amp;gt;FrontEnd&amp;lt;/label&amp;gt;

        &amp;lt;input type="radio" id="switch3-radio2" name="radio"/&amp;gt;
        &amp;lt;label for="switch3-radio2"&amp;gt;BackEnd&amp;lt;/label&amp;gt;

        &amp;lt;input type="radio" id="switch3-radio3" name="radio"/&amp;gt;
        &amp;lt;label for="switch3-radio3"&amp;gt;FullStack&amp;lt;/label&amp;gt;

      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;



&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;For this I have used three html input elements with type &lt;code&gt;radio&lt;/code&gt;.&lt;br&gt;
Each has it's own label for showing the text.&lt;br&gt;
For highlighting the selected option, I have use the &lt;code&gt;::before&lt;/code&gt; pseudo element on &lt;code&gt;.switch3&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Thanks to new &lt;code&gt;:has&lt;/code&gt; selector of css which made this more easier and cleaner html as well.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Check the css below - &lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

.switch3-container h5{
  margin-bottom: .7rem;
}
.switch3
{

  position: relative;
  height:50px;
  display:flex;
  justify-content:space-around;
}
.switch3 label{
  padding: 1rem;
  z-index:1;
}
.switch3::before{
  content: '';
  position: absolute;
  left:0;
  width: 34%;
  height: 100%;
  background: #14142a;
  border: 1px solid #fff;
  border-radius: 12px;
  opacity: .5;
  transition: .5s left ease;
}

.switch3:has(#switch3-radio1:checked)::before{
  left: 0%;
}
.switch3:has(#switch3-radio2:checked)::before{
  left: 33%;
}
.switch3:has(#switch3-radio3:checked)::before{
  left: 66%;
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;
&lt;p&gt;That's how all three looks like. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fr0pn066te2zwqmuq46j1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fr0pn066te2zwqmuq46j1.png" alt="Toggle switches using css only with three state switch"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Experiment with my codepen - &lt;a href="https://codepen.io/Navdeep-Mishra-the-solid/pen/abPVEEz" rel="noopener noreferrer"&gt;Codepen Live&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/Navdeep-Mishra-the-solid/embed/abPVEEz?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Similarly we can create 4 state switch as well. &lt;br&gt;
If you have any doubts or questions, feel free to discuss in the comments. &lt;br&gt;
Any better approach? let's discuss. 😎&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;br&gt;
Please follow for more Webdev content. 😉&lt;/p&gt;

&lt;p&gt;Navdeep M.&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>ui</category>
    </item>
    <item>
      <title>Accordion Component With Only CSS [No Javascript]</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Tue, 19 Sep 2023 07:37:53 +0000</pubDate>
      <link>https://forem.com/navdeepm20/accordion-component-with-only-css-no-javascript-195o</link>
      <guid>https://forem.com/navdeepm20/accordion-component-with-only-css-no-javascript-195o</guid>
      <description>&lt;p&gt;Hi Web Dev's, 👋 We all know how much good web dev is that's why we are doing this. When it comes to web design it's a very important skill you must have. Creating component using core technologies improves your core skills.&lt;br&gt;
Today in this tutorial I'll sharing &lt;strong&gt;&lt;em&gt;how I created a simple accordion component with Neomorphism design using only Html and CSS.&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Without wasting time, Let's start -&lt;/p&gt;

&lt;p&gt;If you are not familiar with what is accordion then checkout this - &lt;a href="https://mui.com/material-ui/react-accordion/" rel="noopener noreferrer"&gt;MUI Accordion Component&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;For creating the accordion component we need the basic skeleton first our &lt;strong&gt;HTML&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

&amp;lt;!DOCTYPE html&amp;gt;
&amp;lt;html lang="en"&amp;gt;
&amp;lt;head&amp;gt;
  &amp;lt;meta charset="UTF-8"&amp;gt;
  &amp;lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&amp;gt;
  &amp;lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&amp;gt;
  &amp;lt;link rel="preconnect" href="https://fonts.googleapis.com"&amp;gt;
&amp;lt;link rel="preconnect" href="https://fonts.gstatic.com" crossorigin&amp;gt;
&amp;lt;link href="https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700;800;900&amp;amp;display=swap" rel="stylesheet"&amp;gt;


  &amp;lt;title&amp;gt;Document&amp;lt;/title&amp;gt;
&amp;lt;/head&amp;gt;
&amp;lt;body&amp;gt;
  &amp;lt;main class="container"&amp;gt;
  &amp;lt;div class="accordion"&amp;gt;
    &amp;lt;div class="accordion__head"&amp;gt;
    &amp;lt;p class="accordion__title"&amp;gt;
      Hey there, I am a accordion title      
    &amp;lt;/p&amp;gt;
    &amp;lt;div class="accordion__opener"&amp;gt; 
        &amp;lt;input type="checkbox" id="accordion-opener-input" checked&amp;gt;
      &amp;lt;label for="accordion-opener-input"&amp;gt;
          &amp;lt;i class="fa-solid fa-caret-up"&amp;gt;&amp;lt;/i&amp;gt;
          &amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
     &amp;lt;div class="accordion__description"&amp;gt;
      &amp;lt;p&amp;gt;Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. &amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;

  &amp;lt;/div&amp;gt;
  &amp;lt;/main&amp;gt;
  &amp;lt;script src="https://kit.fontawesome.com/31571152d6.js" crossorigin="anonymous"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&amp;lt;/html&amp;gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;We'll not go in details of html structure. Here I used the good old trick to check for the open and close state like we do for switch. I have used the input type checkbox to toggle between open and closed states.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Now let's come to the heart of the web. &lt;strong&gt;The CSS Style.&lt;/strong&gt;&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

*{
  margin:0;
  padding:0;
}
*,*::before,*::after{
  box-sizing:border-box;
}
img {
  max-width:100%;
  display:block;
}

:root{
  --clr-primary: #d9d9d9;
  --clr-secondary:#fafafa;
  --clr-clear:#ffffff;
  --clr-grey: #6d6d6d;
  --clr-dark:#1e1e1e;
  --ff-base:'Inter', sans-serif;

  --fw-regular: 400;

  --fs-200:0.875rem;
  --fs-300:1rem;
  --fs-400:1.125rem;
  --fs-500:1.375rem;
  --fs-600:1.75rem;
  --fs-700:3.25rem;

}
html{
  color-scheme: light dark;
}
body{
  font-family:var(--ff-base);
  font-size: var(--fs-300);
  line-height:1.5;
  font-weight: var(--fw-regular);
  height:100vh;

}
main {
  display:flex;
  justify-content:center;
  align-items:flex-start;
  height:80%;
  padding-top:4rem;
}
.accordion{
  font-size:inherit;
  padding: 1.2em 2em;
  border-radius:.5em;
  max-width:30rem;
  width:100%;
  box-shadow:  10px 10px 30px #000000,
             -10px -10px 30px #1f1f1f;
  transition: box-shadow .5s ease;
}
.accordion:hover{
  box-shadow:  10px 10px 20px #000000,
             -10px -10px 20px #1f1f1f;
}
.accordion__head{
  display:flex;
  justify-content:space-between;
}
.accordion__title{
  display:inline-block;
}
.accordion__opener{
  display:inline;
  margin-left:.5rem;

}
.accordion__opener input{
  display:none;
}
.accordion__opener label{
  cursor:pointer;
}
.accordion__opener label i {
/*   transform: rotate(90deg); */
  display:inline-block;
  transition: transform .4s ease;

}
.accordion__description{
  overflow:hidden;
  margin-top:0;
  display:grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s, margin-top .5s; 
  color: var(--clr-grey);

}
.accordion__description p {
  overflow: hidden;
}
.accordion__opener input:checked + label i{
  transform: rotate(180deg);
}
.accordion__head:has(.accordion__opener input:checked) + :is(.accordion__description){
  margin-top: 10px;
  grid-template-rows: 1fr;
}

@media (prefers-color-scheme: light){
  body{
    background: #e0e0e0;
  }
  .accordion{
    background: #e0e0e0;
box-shadow:  20px 20px 60px #bebebe,
             -20px -20px 60px #ffffff;
  }
  .accordion:hover{
    background: #e0e0e0;
    box-shadow:  20px 20px 30px #bebebe,
             -20px -20px 30px #ffffff;
  }
}


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;Here I have used the basic Css normalization for removing default styling of few things. Also declared few variables for reusing properties and making our life easier.😆&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Now what's different here?&lt;/strong&gt; &lt;em&gt;In most of the tutorial for creating the css only accordion, you'll find out that they we mentioning the &lt;strong&gt;max-width&lt;/strong&gt; property. Which is not good sometime when you don't know how much height your content can have. &lt;br&gt;
In this I have used the &lt;strong&gt;css grid trick&lt;/strong&gt;. With &lt;strong&gt;css grid-template-row&lt;/strong&gt;, I am manipulating the height and achieving the same functionality without mentioning &lt;strong&gt;max-width&lt;/strong&gt; on the description. You can use &lt;strong&gt;max-width&lt;/strong&gt; trick as well if your use case requires that.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Also I have used the *&lt;em&gt;BEM Naming convention for Css *&lt;/em&gt; which is a standard for writing the Css classes.&lt;/p&gt;

&lt;p&gt;For generating the Neomorphism styles I have used a Neomorphism style generator. Link is in the resources section.&lt;/p&gt;

&lt;p&gt;Checkout the Codepen here - &lt;a href="https://codepen.io/Navdeep-Mishra-the-solid/pen/eYbpXgb" rel="noopener noreferrer"&gt;CSS Only Accordion Component&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Useful Resources:&lt;/em&gt;&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;&lt;em&gt;BEM Convention&lt;/em&gt; - &lt;a href="https://getbem.com/naming/" rel="noopener noreferrer"&gt;Checkout&lt;/a&gt; &lt;br&gt;
&lt;em&gt;Neomorphism Generator&lt;/em&gt; - &lt;a href="https://neumorphism.io/#e0e0e0" rel="noopener noreferrer"&gt;Checkout&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Feel free to discuss more about the article in the comments below😎&lt;br&gt;
&lt;em&gt;Thanks for reading. &lt;br&gt;
Please like and share.&lt;/em&gt;&lt;br&gt;
&lt;strong&gt;Follow for more post on #webdev&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>ui</category>
      <category>design</category>
      <category>html</category>
    </item>
    <item>
      <title>Killing the Create React App - CRA to Vite migration guide (Javascript)</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Fri, 25 Aug 2023 19:13:57 +0000</pubDate>
      <link>https://forem.com/navdeepm20/killing-the-create-react-app-cra-to-vite-migration-guide-javascript-1f5</link>
      <guid>https://forem.com/navdeepm20/killing-the-create-react-app-cra-to-vite-migration-guide-javascript-1f5</guid>
      <description>&lt;p&gt;Create React App (CRA) is a popular tool for creating React applications. It provides a quick and easy way to get started with React, but it can be limiting in terms of features and flexibility. Vite is a newer build tool that offers a number of advantages over CRA, including faster development times, smaller bundle sizes, and more customization options.&lt;/p&gt;

&lt;p&gt;Here are some of the reasons why you might want to migrate from CRA to Vite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Faster development times: Vite uses native ES modules and has a built-in dev server that can hot reload your changes in real time. This can save you a lot of time when you're developing your application.&lt;/li&gt;
&lt;li&gt;Smaller bundle sizes: Vite uses modern build tools to optimize your code, which can result in smaller bundle sizes. This can improve the performance of your application and make it easier to deploy to production.&lt;/li&gt;
&lt;li&gt;More customization options: Vite has a simpler configuration than CRA, which gives you more control over how your application is built. This can be helpful if you need to customize your build process for specific needs.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Of course, there are also some potential drawbacks to migrating to Vite:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Less community support: Vite is not as widely used as CRA, so there is less community support available. This can make it more difficult to find help with problems you might encounter when using Vite.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Overall, the benefits of migrating from CRA to Vite outweigh the drawbacks. If you're looking for a faster, more customizable, and more performant build tool for your React applications, then Vite is a great option.&lt;/p&gt;

&lt;p&gt;Let's now quickly see how we can do that. 😎&lt;/p&gt;

&lt;p&gt;If you already have an app running on Create React App or CRA with JS template then follow the below steps to migrate safely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; &lt;em&gt;I am using &lt;code&gt;Yarn&lt;/code&gt; here for package management. If you are using &lt;code&gt;npm&lt;/code&gt; or &lt;code&gt;pnpm&lt;/code&gt; then use commands according to your package manager.&lt;/em&gt; 😎&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1:&lt;/strong&gt;&lt;br&gt;
We have to install first vite in our project. 🔥&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add -D vite @vitejs/plugin-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2:&lt;/strong&gt;&lt;br&gt;
Uninstall the react-script (CRA) from your project. 😆&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn remove react-scripts
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3:&lt;/strong&gt;&lt;br&gt;
Let's modify our &lt;code&gt;package.json&lt;/code&gt; scripts. 😮&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;"scripts": {
  "dev": "vite",
  "build": "vite build",
  "serve": "vite preview"
},
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 4:&lt;/strong&gt;&lt;br&gt;
Create the &lt;code&gt;vite.config.json&lt;/code&gt; in your root directory of the project 😯&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;touch vite.config.js
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 5:&lt;/strong&gt;&lt;br&gt;
Copy paste the content mentioned below in your &lt;code&gt;vite.config.js&lt;/code&gt; 🤔&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig(() =&amp;gt; {
  return {
    build: {
      outDir: 'build',
    },
    plugins: [react()],
  };
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;br&gt;
Now one of the crucial step is to rename all the existing files from js to jsx. Vite not supports js file containing any jsx syntax like '&amp;lt; or &amp;gt;' aka angular brackets but if you think any file is by mistake renamed then revert back that file to .js extension. 😆😆😆😆😆&lt;/p&gt;

&lt;p&gt;To do that we have a smart command. Thanks to this &lt;a href="https://gist.github.com/parties/90cdf35f9a3d05bea6df76dc83a69641" rel="noopener noreferrer"&gt;Github Conversation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if using git then run this command in your root directory in bash terminal.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l "&amp;lt;/" $0' {} \; -exec bash -c 'git mv "$0" "${0%.js}.jsx"' {} \;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if not using git then run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# finds all *.js files that have either `&amp;lt;/` or `/&amp;gt;` tags in them and renames them to *.jsx
find ./src -type f -name '*.js' -not -name '*.jsx' -not -name '*.ejs' -exec bash -c 'grep -l -E "&amp;lt;/|/&amp;gt;" "$0"' {} \; -exec bash -c 'mv "$0" "${0%.js}.jsx"' {} \;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 6:&lt;/strong&gt;&lt;br&gt;
After renaming, move the &lt;code&gt;index.html&lt;/code&gt; from &lt;code&gt;public&lt;/code&gt; folder to your root directory. 🙃&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mv public/index.html .
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 7:&lt;/strong&gt;&lt;br&gt;
Afterward, remove all %PUBLIC_URL% occurrences in the index.html file like mention below. You can use global search &lt;code&gt;ctrl+shift+s&lt;/code&gt; in vs code to find and replace it. 🫡&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- &amp;lt;link rel="icon" href="%PUBLIC_URL%/favicon.ico" /&amp;gt;
+ &amp;lt;link rel="icon" href="/favicon.ico" /&amp;gt;

&amp;lt;!-- do this for all occurrences  --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 8:&lt;/strong&gt;&lt;br&gt;
Last, link the src/index.js file in your moved index.html file like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;body&amp;gt;
  &amp;lt;div id="root"&amp;gt;&amp;lt;/div&amp;gt;
  &amp;lt;script type="module" src="/src/index.jsx"&amp;gt;&amp;lt;/script&amp;gt;
&amp;lt;/body&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all for normal project using CRA. We'll see few bonus tips ass well. 😉&lt;/p&gt;

&lt;p&gt;Now run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now open your browser and type &lt;code&gt;localhost:5173&lt;/code&gt; you'll see your project running. 😎&lt;/p&gt;

&lt;p&gt;That's all for a project running on CRA. &lt;/p&gt;

&lt;p&gt;Now Let's see some bonus tips.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you are using **svg's&lt;/strong&gt; as React Component you have to install &lt;code&gt;svgr&lt;/code&gt;. Run**
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;yarn add vite-plugin-svgr
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now modify your &lt;code&gt;vite.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';

export default defineConfig(() =&amp;gt; {
  return {
    build: {
      outDir: 'build',
    },
    plugins: [
      react(),
      // svgr options: https://react-svgr.com/docs/options/
      svgr({ svgrOptions: { icon: true } }),
    ],
  };
});

// which allows you to import SVGs as React components
// import { ReactComponent as MyIcon } from './my-icon.svg';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you want to use the path alias, then modify your &lt;code&gt;vite.config.js&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import path from 'path';
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import svgr from 'vite-plugin-svgr';

export default defineConfig(() =&amp;gt; {
  return {
    resolve: {
      alias: {
        '~': path.resolve(__dirname, './src'),
      },
    },
    build: {
      outDir: 'build',
    },
    plugins: [react()],
  };
});

// which allows you to import from folders under the /src folder
// import Button from '~/components/Button';
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you want to open browser on server start, add the following code in your &lt;code&gt;vite.config.js&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig(() =&amp;gt; {
  return {
    server: {
      open: true,
    },
    build: {
      outDir: 'build',
    },
    plugins: [react()],
  };
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;If you face error for your env variables saying process is undefined or anything similar then remove the &lt;strong&gt;REACT_APP&lt;/strong&gt; prefix from them and instead write &lt;code&gt;VITE&lt;/code&gt; as prefix and instead of using &lt;code&gt;process.env&lt;/code&gt; use &lt;code&gt;import.meta.env.[VARIABLE_NAME]&lt;/code&gt; For more info on vite env variable and modes &lt;a href="https://vitejs.dev/guide/env-and-mode.html" rel="noopener noreferrer"&gt;Check Here&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;i.e -&lt;/p&gt;

&lt;p&gt;&lt;code&gt;.env&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REACT_APP_TEST=true
//to
VITE_TEST=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Use in this way&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;//from 
process.env.REACT_APP_TEST=true
//to
import.meta.env.VITE_TEST=true
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;If you are using emotion, update your &lt;code&gt;vite.config.js&lt;/code&gt;&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';

export default defineConfig(() =&amp;gt; {
  return {
    build: {
      outDir: 'build',
    },
    plugins: [
      react({
        jsxImportSource: '@emotion/react',
        babel: {
          plugins: ['@emotion/babel-plugin'],
        },
      }),
    ],
  };
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That's all for this guide. 😉 If you face any issue or have any updates please comment below. &lt;strong&gt;For more content please Share, Like and Follow.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Thankyou 😎&lt;/p&gt;

</description>
      <category>react</category>
      <category>vite</category>
      <category>createreactapp</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Appwrite Functions: The Ultimate Guide to deploy serverless functions with Appwrite Cloud</title>
      <dc:creator>Navdeep Mishra</dc:creator>
      <pubDate>Sat, 19 Aug 2023 18:52:46 +0000</pubDate>
      <link>https://forem.com/navdeepm20/appwrite-functions-learn-to-deploy-serverless-functions-within-minutes-5918</link>
      <guid>https://forem.com/navdeepm20/appwrite-functions-learn-to-deploy-serverless-functions-within-minutes-5918</guid>
      <description>&lt;p&gt;Hey everyone, Today we'll see how we can deploy our own Appwrite function with Appwrite Cloud within minutes. It's so easy and useful.&lt;/p&gt;

&lt;p&gt;So for getting started first create your account here - &lt;a href="https://cloud.appwrite.io/login" rel="noopener noreferrer"&gt;Appwrite Cloud&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fy3da08p4h8dki35sm922.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fy3da08p4h8dki35sm922.png" alt="'appwrite cloud home'" width="800" height="383"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After signup create a project, click on &lt;strong&gt;Functions&lt;/strong&gt; as shown below - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.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%2Fs7hrlft8t86b6bawdoxe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.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%2Fs7hrlft8t86b6bawdoxe.png" alt="'Appwrite functions'" width="351" height="916"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After this there are two ways to deploy it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Method 1  - Appwrite CLI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Appwrite provide a featured packed CLI for managing your Appwrite projects. This is a one time process and helps a lot in deploying your functions easily.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Install the Appwrite CLI -&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

npm install -g appwrite-cli


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;or dependency free installation&lt;/strong&gt;&lt;/em&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;For Mac &lt;/p&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;

&lt;p&gt;brew tap appwrite/sdk-for-cli &lt;a href="https://github.com/appwrite/sdk-for-cli" rel="noopener noreferrer"&gt;https://github.com/appwrite/sdk-for-cli&lt;/a&gt;&lt;br&gt;
brew update&lt;br&gt;
brew install --HEAD appwrite&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt; For windows 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;iwr -useb &lt;a href="https://appwrite.io/cli/install.ps1" rel="noopener noreferrer"&gt;https://appwrite.io/cli/install.ps1&lt;/a&gt; | iex&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
&amp;gt; For Linux
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;curl -sL &lt;a href="https://appwrite.io/cli/install.sh" rel="noopener noreferrer"&gt;https://appwrite.io/cli/install.sh&lt;/a&gt; | bash&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- After the installation is complete, verify the install using

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite -v&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Now, Login to the appwrite cli. This will ask for your email and password. If you logged in with social auth try password reset and set a password first.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite login&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;

!['Appwrite login'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/48y13noe32pjd917p5zp.png)

- After this, verify that you can access your project - 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite projects get --projectId [PROJECT_ID]&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
- Now our appwrite cli setup is complete and now let's set up our function.

&amp;gt; Now we have to connect our existing project first. Run


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite init project&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Select the existing project and after that you'll see result like this in your console.


!['appwrite project init'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/f46uybzmytf9nj4onmi7.png)

- Now run below command to initialize your project.

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite init function&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
!['appwrite init function image'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/4irzjew68o2rcuotrout.png)

- Now here you have to select your runtime. If you want to deploy a javascript function then select _node runtime_. I have selected _node runtime_ here.

**_After selecting this our function is created_**.

!['appwrite function directory image'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/pes8jwp8t2amhtn85tqn.png)

- Update `src/index.js` with your function code. For detailed information about functions visit [here](https://appwrite.io/docs/functions).

- Once you have updated your code then

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;appwrite deploy function&lt;/p&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;- Select your function with `arrow keys` and confirm with `space` and hit 'enter'.

**Congratulations** 🎊🎊🎊 _Your Appwrite function is deployed successfully in Appwrite Cloud.
Now visit your functions dashboard, open the function you deployed just now. Go to settings tab and change the execution policies according to your need. Now Execute the function on event or add custom schedules for execute from your code. You can check function execution in the function dashboard by clicking on `Execute` button._

**Method 2 - Appwrite Cloud**

- Login to your Appwrite cloud account and navigate to functions page.

- Click on _create function_ button and enter necessary details.

!['Create function appwrite cloud'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/x1k2n91n6mgy6ktl39oi.png)

- In the next optional steps you can add _Events_, _Execute Access_, _Schedule_ and _Variables_ for your Appwrite function and then hit _Create_

**_Your Appwrite function is created._** 🔥

Wait .......................... 🤔🤔🤔🤔
We have to add code as well right?....
So let's proceed then..

- After creating your function you should see this screen.

!['appwrite function'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/psl5pf1v5vwuih35xfer.png)

- Now just pick your `index.js` file (with all code) and `package.json` and create a `tar.gz` compressed file. You can use **7zip** if you are in windows platform.

- Once you have create `tar.gz` compressed file. Go to function dashboard and click on **Create Deployment** and upload this `tar.gz` file like shown below and mention `index.js` as the entry point.


!['uploading the tar.gz files'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/d337asp1j4cfbzyvx7fh.png)
- Also check the **Activate deployment** checkbox to activate function after deployment.

**Congratulations** 🎊🎊🎊 _Your Appwrite function is deployed successfully in Appwrite Cloud.

- Once done click on `Execute Now` button and you'll see this.

!['Function executed successfully'](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1yxxea30yau2fc7t92tn.png)

_You can check logs where you can find all error logs, console logs or response returned by your Appwrite function._

_That's all, You have successfully learned how to deploy Appwrite function.

Thankyou for reading this😉
Please like 💓, share 🌐 and follow 🙍‍♂️ for more useful content._

Navdeep M.























&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

</description>
      <category>appwrite</category>
      <category>serverless</category>
      <category>cloudfunctions</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
