<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Subhanu on Medium]]></title>
        <description><![CDATA[Stories by Subhanu on Medium]]></description>
        <link>https://medium.com/@subhanusroy?source=rss-e65b1af744c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*Ik7AS94x5dUi5YXq7Udx4A.jpeg</url>
            <title>Stories by Subhanu on Medium</title>
            <link>https://medium.com/@subhanusroy?source=rss-e65b1af744c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 19:20:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subhanusroy/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[A Beginner's Guide to LaTeX for ATS-friendly resumes]]></title>
            <link>https://medium.com/@subhanusroy/a-beginners-guide-to-latex-for-ats-friendly-resumes-ab0919930a30?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/ab0919930a30</guid>
            <category><![CDATA[resume-writing]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[resume]]></category>
            <category><![CDATA[job-hunting]]></category>
            <category><![CDATA[applicant-tracking-system]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Thu, 25 Jul 2024 13:50:12 GMT</pubDate>
            <atom:updated>2024-07-25T14:56:34.116Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l-X4KYzzceEF8Hvsf7lDKQ.png" /><figcaption>A Beginner’s Guide to LaTeX for ATS-friendly resumes</figcaption></figure><p>Whether you are</p><ul><li>a developer who wants to make a technical resume</li><li>someone who wants to make an ATS-friendly resume or</li><li>a complete <em>beginner</em> who does not know how to make a resume</li></ul><p>this short and crisp guide will help you understand <strong>what is LaTeX</strong>, how to <strong>write/edit LaTeX</strong> code, and how we can use it to make <strong>resumes that pass all Applicant Tracking Systems (ATS)</strong>.</p><p><strong>BONUS</strong>: A sample resume template, ready to edit is also given below.</p><p><em>If you want me to write a resume for you or help you with it (for free!) or want to explore any of the services I provide, you can connect with me </em><a href="https://www.linkedin.com/services/page/6806ab330635410258"><em>here</em></a></p><p>So let’s dive right in!</p><h3>1. Introduction to LaTeX</h3><h4>What is LaTeX?</h4><ul><li><strong>LaTeX</strong>: A typesetting system for producing high-quality documents.</li><li><strong>Not a Word Processor</strong>: Unlike MS Word; it focuses on content, not appearance.</li></ul><p><strong>Why LaTeX?</strong></p><ul><li>Professional look</li><li>Easy to maintain</li><li>Consistent formatting</li><li>ATS can parse the LaTeX code easily, hence easy to pass the ATS test</li></ul><h4>Advantages of Using LaTeX for Resumes</h4><ul><li><strong>Professional appearance</strong>: Clean and polished layouts.</li><li><strong>Flexibility</strong>: Full control over design and formatting.</li><li><strong>Scalable</strong>: Easily update and version your resume.</li><li><strong>Support for Symbols &amp; Equations</strong>: Perfect for technical resumes.</li></ul><h3>2. Getting Started with LaTeX</h3><h4>Installation and Setup</h4><p><strong>Online Editors</strong>:</p><ul><li><a href="https://www.overleaf.com/">Overleaf</a>: User-friendly, no installation needed. Lifetime free version does almost everything, no need to upgrade.</li><li><strong>Others</strong>: TeXShop, TeXworks for offline use.</li></ul><p><strong>Basic Document Structure</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ff8NBTFvmk92xYt_7zrQqw.png" /><figcaption>Basic Document Structure of LATEX</figcaption></figure><h4>Basic Syntax and Commands</h4><p><strong>Text Formatting</strong>:</p><ul><li>Bold: \textbf{bold text}</li><li>Italics: \textit{italic text}</li><li>Underline: \underline{underlined text}</li></ul><p><strong>Sections</strong>:</p><ul><li>\section{Section Title}</li><li>\subsection{Subsection Title}</li><li>\subsubsection{Subsubsection Title}</li></ul><h3>3. Creating the Header and Contact Information</h3><h4>The Header</h4><ul><li><strong>Name</strong>: \textbf{John Doe}</li><li><strong>Positioning</strong>: Centered, large font</li></ul><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aheXiB4tEg-b6Bl-t5NYtQ.png" /><figcaption>The name in the center</figcaption></figure><h4>Contact Information</h4><p><strong>Details</strong>:</p><ul><li>Phone: \texttt{(123) 456–7890}</li><li>Email: \texttt{johndoe@example.com}</li><li>LinkedIn: \texttt{linkedin.com/in/johndoe}</li><li><strong>Layout</strong>: This can be placed under the name or in a sidebar.</li></ul><h3>4. Professional Summary or Objective</h3><h4>Writing a Strong Professional Summary</h4><p><strong>Focus</strong>:</p><ul><li>Key experience</li><li>Core skills</li><li>Career aspirations</li></ul><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vf5ZlXr7N4ZrPvGbjRjwjQ.png" /><figcaption>Professional Summary</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*CIhaJIsKxAk7R_-uJGRgmA.png" /><figcaption>How it appears in LATEX editors</figcaption></figure><h4>Objective Statement (Optional)</h4><p><strong>When to use</strong>:</p><ul><li>Early-career professionals</li><li>Career changers</li></ul><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*giX_2XZFksPMZaRcTiWUTw.png" /><figcaption>Objective as a LATEX section</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*idRzX8ioVoyTj_-SYxowWw.png" /><figcaption>Objective in Resumes</figcaption></figure><h3>5. Education Section</h3><h4>Listing Educational Background</h4><p><strong>Format</strong>:</p><ul><li>Institution, Degree, Major, Graduation Date</li></ul><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IoY5ufFOrS-kHseE-jWq4w.png" /><figcaption>Education in LATEX</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/308/1*qRzXsK3YPJaTjrjdjJMdsg.png" /><figcaption>How it appears in LATEX</figcaption></figure><h4>Bullet Points for Achievements</h4><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CPaCgSQ4txJn8OwvPR-7pA.png" /><figcaption>Achievements in LATEX</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*og1_YFg9LoVBpnD0rZFqnQ.png" /><figcaption>how it appears</figcaption></figure><h3>6. Work Experience Section</h3><h4>Structuring Work Experience</h4><p><strong>Details</strong>:</p><ul><li>Job Title, Company, Location, Dates</li></ul><h4>Bullet Points for Responsibilities and Achievements</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XAXnryswF-ewa-TBYGrAWQ.png" /><figcaption>LATEX for Work Experience</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*Csmhnyz57su5RxoVl8jmiw.png" /><figcaption>how it appears in LATEX</figcaption></figure><h3>7. Skills Section</h3><h4>Listing Skills</h4><p><strong>Categories</strong>:</p><ul><li>Technical Skills</li><li>Languages</li><li>Tools and Technologies</li></ul><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZLwMfESbEnE4hHKRH9c88Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/686/1*xp1nrV1g9AqsqtSmBe2P7g.png" /></figure><h3>8. Additional Sections (Optional)</h3><h4>Certifications</h4><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tCukmW_cEbYL_jRdaCcSuA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*4_dQPFruGqHWiGVb7QQc8g.png" /></figure><h4>Projects</h4><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gKiWJyjcV9yOE_qApM5kPg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*NURYes3OIUZ1QYTwWugHjA.png" /></figure><p>You can add the description of the projects in bullet points using /item as we have seen before.</p><h4>Awards and Honors</h4><p><strong>Example</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XGKplLW4LyqhrbxA-kbQCQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/682/1*fib33sq44eqAtirlj3Kbmw.png" /></figure><h3>9. Customizing the Layout and Style</h3><h4>Using LaTeX Packages</h4><ul><li><strong>Popular Packages</strong>:</li><li>resume: Simple and minimalistic design.</li><li>moderncv: Modern and stylish layout.</li></ul><p><strong>Installation</strong>:</p><p>\usepackage{package_name}</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JpsoUNgp1lGpUUEEVF_iEA.png" /></figure><p><a href="https://www.overleaf.com/learn/latex/Page_size_and_margins">Geometry</a> package allows us to have margins in documents and other features.</p><p><a href="https://ctan.org/pkg/enumitem?lang=en">Enumitem</a> is a package that allows more control of the bullet points, their layouts, etc.</p><h4>Customizing Fonts and Colors</h4><p><strong>Changing Fonts</strong>:</p><p>Use packages like fontspec or mathpazo.</p><p><strong>Adding Colors</strong>:</p><p>\usepackage{xcolor}</p><p>\color{blue} Text in blue</p><h3>10. Conclusion and Final Tips</h3><h4>Review and Proofreading</h4><p><strong>Tips</strong>:</p><ul><li>Check for typos and grammatical errors.</li><li>Ensure consistency in formatting.</li></ul><h4>Version Control and Updates</h4><ul><li><strong>Use Git</strong>: Track changes and maintain versions.</li><li><strong>Keep it Updated</strong>: Regularly update with new skills and experiences.</li></ul><h3>11. Example Resume in LaTeX</h3><h4>Full Sample Resume</h4><p>Here is a <a href="https://www.overleaf.com/read/nmqztxzbkcdt#d42cf4">sample resume</a> made on Overleaf which uses the basics of these concepts and you can make a copy of this and edit it.</p><p>Here is an example of how it looks:</p><figure><img alt="Sample Resume template in LATEX on Overleaf" src="https://cdn-images-1.medium.com/max/1024/1*QbvkSF8M0ZDtucrVl8OLZw.png" /></figure><h3>12. Conclusion</h3><p>So in this short article, I tried to cover how we can make ATS-friendly resumes using LaTeX.</p><p>We learned basic LaTeX code structures and saw how each appears.</p><p>LaTeX resumes are easy to parse for the Applicant Tracking Systems, hence resumes made using it, almost always pass the ATS test.</p><p>If you have any queries, you can always ask in the comments, I will be happy to assist you.</p><p>Thanks for reading!</p><p>If you read till here, I would be grateful if you could clap a few times. Keeps me motivated to write more such guides 😁</p><p>Cheers 🍻</p><p><em>If you want me to write a resume for you or help you with it (for free!) or want to explore any of the services I provide, you can connect with me </em><a href="https://www.linkedin.com/services/page/6806ab330635410258"><em>here</em></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ab0919930a30" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multithreading in NodeJS — using worker threads]]></title>
            <link>https://medium.com/engineering-at-bajaj-health/multithreading-in-nodejs-using-worker-threads-61463c39861c?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/61463c39861c</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[backend]]></category>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[multithreading]]></category>
            <category><![CDATA[threads]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 18:34:40 GMT</pubDate>
            <atom:updated>2024-03-15T08:19:50.511Z</atom:updated>
            <content:encoded><![CDATA[<h3>Multithreading in NodeJS — using worker threads</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KADlXCfgjqyZeocjueXFgg.png" /></figure><p>Whether you are</p><ul><li>a <em>seasoned pro</em> using NodeJS to build a scalable backend which involves some complex tasks like processing images, uploading PDFs, encryption, etc, or</li><li>someone who is shifting from a multithreaded language like Java or Go to NodeJS, or</li><li>a complete <em>beginner</em> learning backend in Javascript</li></ul><p>this article will help you understand what <strong>NodeJS </strong>is, its <strong>limitations</strong>, what <strong>multithreading </strong>is, and how to get started with <strong>Multithreading in NodeJS</strong>.</p><p>So let’s dive right in!</p><h3>What is NodeJS?</h3><p>NodeJS is a <strong>server-side Javascript run time</strong> built on the V8 JS engine which has gained immense popularity in the development community because of its</p><ul><li>event-driven,</li><li>non-blocking input-output model</li></ul><p>which makes it well-suited for building i/o based <strong>scalable </strong>and <strong>high-performance</strong> applications</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uaXPLbNrJTycs28U.png" /><figcaption>Inner working of NodeJs — GeeksForGeeks</figcaption></figure><h3>What are its limitations?</h3><p>NodeJs is <strong>single threaded</strong> which makes handling multiple IO-bound requests easy.</p><p>But when there are <strong>CPU-intensive tasks</strong> like converting an html to a pdf, compression of documents, image processing or doing a complex calculation, NodeJs is not at all efficient.</p><p>Some cons of the single-threaded nature of NodeJs are:</p><h4><strong>Blocking Operations</strong></h4><p>Any blocking operation can potentially stall the entire application in a single-threaded environment. CPU-bound tasks or operations with significant processing time can lead to delays in handling other events.</p><p><strong>Example 1 — Hashing elements in a large array</strong></p><p>We have to perform CPU-intensive tasks like hashing every element in a vast array using the crypto module</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w-lKTqvAKrKXJLw-7g5jyQ.png" /><figcaption>Hashing all elements of a large array</figcaption></figure><p>This block of code takes a lot of computational time.</p><p>Since Node.js runs callbacks registered for events in the Event Loop, this callback code will block the Event Loop thread and cannot handle requests from other clients until it finishes its execution.</p><p><strong>Example 2 — Calculating the nth Fibonacci number (n&gt;35)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VSuYVlQ0ZjO9BZNB8DwJpg.png" /><figcaption>nth Fibonacci Number</figcaption></figure><p>In this example, we have a simple recursive function to calculate the Fibonacci sequence. The recursive nature of the function makes it computationally expensive. When running this function with a large value of n in a single-threaded Node.js environment, it can lead to a significant delay in processing other tasks. The event loop gets blocked, and the application becomes less responsive.</p><p><strong>Example 3 — Image Processing</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G4EESqeck3INDiIsnrtcyw.png" /><figcaption>Resizing and grayscaling an image using sharp</figcaption></figure><p>In this example, we use the sharp library to perform image processing tasks such as resizing and converting to grayscale. Image processing, especially with large files, can be CPU-intensive. When executing this code in a single-threaded environment, it may take a considerable amount of time to process the image, impacting the responsiveness of the application for other tasks.</p><h4><strong>Limited CPU Utilization</strong></h4><p>Node.js cannot fully utilize multi-core processors due to its single-threaded architecture. In scenarios where parallel processing could significantly improve performance, the single-threaded model falls short.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*THVxDl38xJOeBYKh" /><figcaption>Cons of single-threaded NodeJs: Limited CPU Utilization</figcaption></figure><h4><strong>Scalability Challenges</strong></h4><p>Scaling vertically (adding more resources to a single server) can only go so far. Horizontal scaling (adding more servers) is often preferred, but Node.js, in its native form, may not fully leverage the potential of multi-core servers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/0*6Jq7mox_-RX9BV5B" /><figcaption>Vertical scaling on the left, horizontal scaling on the right</figcaption></figure><h3>Multithreading vs Single-Threaded Languages</h3><p>In the simplest of terms,</p><blockquote>Single-threaded languages can only execute one task at a time, while multi-threaded languages can execute multiple tasks simultaneously.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*q8BP6_4Fbpp-Btbc.png" /><figcaption>Single-threaded vs Multithreaded</figcaption></figure><p>Single-threaded languages are straightforward and suitable for simple applications. They are also easy to debug and maintain because of their sequential nature.</p><p>Multi-threaded languages can potentially improve performance and responsiveness. For example, Apache servers use a multi-threading mechanism to handle multiple requests simultaneously.</p><p>Ok so now we have understood theoretically, let&#39;s look at it practically.</p><h3>Performance testing single-threaded NodeJS</h3><p>We will create a simple node-express server with 2 routes:</p><ul><li>“/” route: will be a simple non-blocking operation</li><li>“/blocking” route: will perform the calculation of the 45th Fibonacci number</li></ul><p>Then we will check the response times for 3 scenarios:</p><ol><li>Send a request to “/”</li><li>Send a request to “blocking”</li><li>Send request to “/” while “/blocking” is in progress</li></ol><h4>Setup Project</h4><p>Go to any directory of your choice and run the below command in the terminal:</p><pre>npm init</pre><h4>Index.js file</h4><pre>import express from &quot;express&quot;;<br><br><br>const app = express()<br>const port = process.env.PORT || 5000;<br><br>// Making 2 routes: normal and blocking<br><br>app.get(&quot;/&quot;, (req, res) =&gt; {<br> res.status(200).send(&quot;normal non-blocking page&quot;);<br>});<br><br><br>app.get(&quot;/blocking&quot;, async (req, res) =&gt; {<br> function fibonacci(n) {<br>   if (n &lt;= 1) return n;<br>   return fibonacci(n - 1) + fibonacci(n - 2);<br> }<br><br><br> const result = fibonacci(45);<br><br><br> res.status(200).send(`fibonacci(45) is : ${result}`);<br>});<br><br><br>app.listen(port, () =&gt; {<br> console.log(&quot;Learning multithreading on port &quot;, port);<br>});</pre><p>So now let&#39;s start the server with</p><pre>node index.js</pre><p>And observe the response times in different scenarios:</p><h4><strong>Hitting “/” the first time:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*YxULddxSzJyUxbR9" /></figure><p>response takes <strong>12ms</strong></p><h4><strong>Hitting “/blocking” first time:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*t3H2bTB3IAgJgZQh" /></figure><p>Takes <strong>14+ seconds</strong></p><h4><strong>Hitting “/” while “/blocking” is running:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*6on_a2JyXd_8obb2" /></figure><p>Takes <strong>13.36 seconds</strong> (more than a <strong>100,000% increase</strong> in response time)</p><h4>Why this behavior?</h4><p>When “/blocking” runs, it performs the Fibonacci calculation of 45. The <strong>recursive nature</strong> of the function makes it <strong>computationally expensive</strong>.</p><p>So when this runs, the event loop is blocked by this route, and even if you hit “/” at that time, Node can&#39;t serve the simple response of “/”, since it is single-threaded.</p><p>So how to fix this issue?</p><p>Enter Multithreading in NodeJs using the worker_thread module.</p><h3><strong>Worker Threads module</strong></h3><p>So in NodeJs <a href="https://nodejs.org/en/blog/release/v12.11.0/">V12.11</a>, the <strong>worker_threads</strong> module was made stable, and they introduced it as</p><blockquote><em>Workers (threads) are useful for performing CPU-intensive JavaScript operations.</em></blockquote><p>This module enables the use of threads that execute JS in parallel.</p><p>Code executed in a worker thread runs in a <strong>separate child process</strong> preventing it from blocking your main operation.</p><p>Let&#39;s solve the above issue using the worker threads module.</p><h4><strong>Make a worker.js file</strong></h4><p>Here we will <strong>move the CPU-intensive function</strong> and execute the function.</p><p>Then pass the result using the postMessage function, which communicates with the main thread.</p><pre>import { parentPort } from &quot;worker_threads&quot;;<br><br>//move the function here<br>function fibonacci(n) {<br>  if (n &lt;= 1) return n;<br>  return fibonacci(n - 1) + fibonacci(n - 2);<br>}<br>const result = fibonacci(45);<br><br>// pass the result to parent thread<br>parentPort.postMessage(result)</pre><h4><strong>Add the worker in the index2.js file</strong></h4><p>So now we make a copy of the index file in the index2 file, except we will make the new changes in the index2 file as follows:</p><pre>import express from &quot;express&quot;;<br><br>// import worker<br>import { Worker } from &quot;worker_threads&quot;;<br><br>const app = express();<br>const port = process.env.PORT || 5000;<br><br>app.get(&quot;/&quot;, (req, res) =&gt; {<br>  res.status(200).send(&quot;normal non-blocking page&quot;);<br>});<br><br>app.get(&quot;/blocking&quot;, async (req, res) =&gt; {<br><br>  // constructor a worker, where you pass the path of your worker file<br>  const worker = new Worker(&quot;./worker.js&quot;);<br><br>  // handle when worker thread sends a message to parent<br>  worker.on(&quot;message&quot;, (data) =&gt; {<br>  res.status(200).send(`fibonacci(45) is : ${data}`);<br>  });<br><br>  // handle when worker thread sends an error to parent<br>  worker.on(&quot;error&quot;, (error) =&gt; {<br>  res.status(404).send(`failed to perform: ${error}`);<br>  });<br>});<br><br>app.listen(port, () =&gt; {<br>console.log(&quot;Learning multithreading on port &quot;, port);<br>});</pre><h4>Testing the API as per the 3 scenarios</h4><p>So let&#39;s test the API based on the three scenarios above and observe how the response time has changed for 3rd scenario which is <em>Send request to “/” while “/blocking” is in progress</em></p><h4>Hitting “/” :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*if-siQRATkfTvWg1" /></figure><p>Takes 3ms</p><h4><strong>Hitting “/blocking”:</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oJKvkChSNRKSOdeF" /></figure><p>Takes 14 seconds as usual</p><p><strong>Hitting “/” while “/blocking” is in progress:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*k1phaAxm_GwbbZKz" /></figure><p>takes 3ms (same as if it hit normally)</p><h4><strong>Why this improvement?</strong></h4><p>The “/blocking” is now running on the worker thread (child) while the “/” is working on the main thread. Both are independent of each other.</p><p>We avoid blocking the Event Loop, so it can serve other clients’ requests, improving our application performance.</p><h3>Conclusion</h3><p>Multithreading in NodeJS empowers Node to a great extent and nullifies the cons of it being a single-threaded run time. In this article, we also saw how we can solve an issue caused by single threading using the worker_threads module (with proof of API performance)</p><p>Worker Threads has a lot of other features for communication with the main thread, creating multiple child threads, etc. which can be read in the official <a href="https://nodejs.org/api/worker_threads.html">worker threads documentation</a>.</p><p><strong>Note</strong>: Despite the multi-threaded superpowers added to single-threaded NodeJS, if you are building a scalable backend which has mostly CPU intensive tasks, it’s better to work with a language which supports multi-threading in itself like Java, Go Lang etc.</p><p>Thank you for reading, and happy coding!</p><p>Cheers 🥂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=61463c39861c" width="1" height="1" alt=""><hr><p><a href="https://medium.com/engineering-at-bajaj-health/multithreading-in-nodejs-using-worker-threads-61463c39861c">Multithreading in NodeJS — using worker threads</a> was originally published in <a href="https://medium.com/engineering-at-bajaj-health">Engineering at Bajaj Health</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flipping the Matrix HackerRank Optimised Solution in C++, Java, Python with Explanation]]></title>
            <link>https://medium.com/@subhanusroy/flipping-the-matrix-hackerrank-optimised-solution-in-c-java-python-with-explanation-a3dad70149ee?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3dad70149ee</guid>
            <category><![CDATA[matrix]]></category>
            <category><![CDATA[data-structure-algorithm]]></category>
            <category><![CDATA[cpp]]></category>
            <category><![CDATA[hackerrank]]></category>
            <category><![CDATA[competitive-programming]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Mon, 31 Jul 2023 09:25:49 GMT</pubDate>
            <atom:updated>2023-07-31T09:25:49.506Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nieYxyOn_xYnk3cvyhwQzw.png" /><figcaption>Flipping Matrix HackerRank Solution</figcaption></figure><h4>Difficulty: <strong>Medium</strong></h4><p>Full Problem Description : <a href="https://www.hackerrank.com/challenges/flipping-the-matrix/problem">Flipping the Matrix Problem Description</a></p><h3><strong>Problem Description :</strong></h3><p>Sean invented a game involving a 2n * 2n matrix where each cell of the matrix contains an integer. He can reverse any of its rows or columns any number of times. The goal of the game is to maximize the sum of the elements in the n *n submatrix located in the upper-left quadrant of the matrix.</p><p>Given the initial configurations for q matrices, help Sean reverse the rows and columns of each matrix in the best possible way so that the sum of the elements in the matrix’s upper-left quadrant is maximal.</p><pre># Input :<br><br>matrix = [[1, 2], [3, 4]]<br><br># Output :<br><br>4<br><br># Input :<br><br>matrix = [[112, 42, 83, 119], [56, 125, 56, 49], [15, 78, 101, 43], [62, 98, 114, 108]]<br><br># Output :<br><br>119 + 114 + 56 + 125 = 414 </pre><p>Here we can find solution using following pattern,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/405/0*Wfox-qOaC8iLE80L.png" /><figcaption>Maximise the indexes which have same color</figcaption></figure><p>So simply we have to find Max of same number of box like (1,1,1,1). And last return Sum of all Max numbers.</p><p>We have to return Sum of Top-Left Matrix (1, 2, 3, 4), But before that we have to find Max number from Matrix.</p><h3><strong>C++ Code</strong>:</h3><pre>int flippingMatrix(vector&lt;vector&lt;int&gt;&gt; matrix) {<br>    int sum=0;<br>    int n=matrix.size();<br> <br>    for(int i=0;i&lt;n/2;i++)<br>    {<br>        for(int j=0;j&lt;n/2;j++)<br>        {<br>            sum+=<br>            max(matrix[i][j],<br>                (max(matrix[i][n-1-j],<br>                        (max(matrix[n-1-i][j],matrix[n-1-i][n-1-j]))<br>                    )<br>                )<br>            );<br>        }<br>    }<br>    return sum;<br>}</pre><h3>Java Code:</h3><pre>import java.util.List;<br><br>public class MatrixFlipping {<br>    public int flippingMatrix(List&lt;List&lt;Integer&gt;&gt; matrix) {<br>        int sum = 0;<br>        int n = matrix.size();<br><br>        for (int i = 0; i &lt; n / 2; i++) {<br>            for (int j = 0; j &lt; n / 2; j++) {<br>                sum += Math.max(matrix.get(i).get(j),<br>                        Math.max(matrix.get(i).get(n - 1 - j),<br>                                Math.max(matrix.get(n - 1 - i).get(j), matrix.get(n - 1 - i).get(n - 1 - j))));<br>            }<br>        }<br>        return sum;<br>    }<br>}</pre><h3>Python Code:</h3><pre>def flipping_matrix(matrix):<br>    sum = 0<br>    n = len(matrix)<br><br>    for i in range(n // 2):<br>        for j in range(n // 2):<br>            sum += max(matrix[i][j],<br>                       max(matrix[i][n - 1 - j],<br>                           max(matrix[n - 1 - i][j], matrix[n - 1 - i][n - 1 - j])))<br><br>    return sum</pre><h3><strong>Solution Explanation :</strong></h3><p>Let’s take the example and see,</p><p>matrix = [[112, 42, 83, 119], [56, 125, 56, 49], [15, 78, 101, 43], [62, 98, 114, 108]]</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/214/0*sfm4S-VMajel7sEt.png" /><figcaption>Example</figcaption></figure><p>We have to return Sum of all Max numbers that have same colors. like first we have to find Max from [112, 119, 62, 108] and so on.</p><ul><li>We are looping through only half of list because we have to find Sum of Top-Left corner of matrix.</li><li>As traverse through given List of List we are getting following answer in sum variable.</li></ul><ol><li>sum += Max [112, 119, 62, 108] | sum = 0 + 119</li><li>sum += Max [42, 83, 98, 114] | sum = 119 + 114 = 233</li><li>sum += Max [56, 49, 15, 43] | sum = 233 + 56 = 289</li><li>sum += Max [125, 56, 78, 101] | sum = 289 + 125 = 414</li></ol><ul><li>return sum</li></ul><p>The sum returned will be the maximal sum obtained for the first quadrant.</p><p>If you have any questions or would like to request detailed solutions on other problems, please leave a comment below. Your feedback is valuable, and I am always eager to provide content that meets your needs.</p><p>Thank you for reading, and happy coding!</p><p>Cheers 🥂</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3dad70149ee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Download PDF from API in React (Using Axios and blobs)]]></title>
            <link>https://javascript.plainenglish.io/download-pdf-from-api-in-reactjs-using-axios-and-blobs-699be8a27ca7?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/699be8a27ca7</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[pdf-download]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[api]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Sat, 29 Jul 2023 16:18:35 GMT</pubDate>
            <atom:updated>2024-12-11T02:56:53.091Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*raArZ1balzXqo2sQQkI7ZA.png" /></figure><p>Whether you are a beginner who has started React, or an expert looking to include a feature, this article will help you learn “<strong>How to download PDF from API in ReactJS using Axios</strong>”. We will do it in a 5 step by step approach so let&#39;s jump right in!</p><p><em>P.S You can skip to the end for the full code. If it helped you, do clap</em> 💙</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g9PXe_NNcKq3h9JK" /><figcaption>Photo by <a href="https://unsplash.com/@curvd?utm_source=medium&amp;utm_medium=referral">CURVD®</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>In modern web applications, it is often necessary to download PDFs from an API. In fact its a core feature in many everyday applications.</p><blockquote><em>💡</em> <strong>Pro Tip:</strong> For enhanced PDF handling in your React app, consider using <a href="https://apryse.com/products/webviewer"><strong>WebViewer</strong></a><strong> </strong>to display, annotate, or interact with PDFs directly in the browser, complementing your file download features.</blockquote><p><a href="https://apryse.com/products/webviewer">WebViewer: JavaScript Document SDK | Apryse</a></p><p>It could be as often as downloading a <strong>bill receipt</strong> of your last trip via Uber, <strong>resume</strong> templates online, or <strong>notes</strong> from your email.</p><p>Any and every enterprise application uses this feature for example, <em>PayPal</em> lets you download bills, <em>Dropbox</em> lets you download files from their cloud storage, and you already know about university notes haha!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9XbuEed0w90UaIJJ" /><figcaption>Photo by <a href="https://unsplash.com/@lautaroandreani?utm_source=medium&amp;utm_medium=referral">Lautaro Andreani</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><blockquote>💡 Speed up your blog creation with <a href="https://differ.blog/differ-ai"><strong>DifferAI</strong></a>.</blockquote><blockquote>Available for <strong>free </strong>exclusively on the <strong>free and open blogging platform, </strong><a href="https://differ.blog/"><strong><em>Differ</em></strong></a><strong><em>.</em></strong></blockquote><p><a href="https://differ.blog/differ-ai">Introducing DifferAI</a></p><p><strong>ReactJS</strong>, a popular JavaScript library for building user interfaces, provides various tools and libraries to facilitate this process. One common approach is using the “<strong>axios</strong>” library, simplifying making HTTP requests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/251/1*C3U1vRzQbRO6uM1yetvWzw.png" /></figure><p>Regarding file downloading, ReactJS offers a powerful feature called <strong>blobs (Binary Large Objects)</strong>. Blobs allow us to <strong>handle binary data</strong>, such as files, more efficiently. By utilizing blobs, we can easily download files from an API and provide a seamless user experience.</p><p>In this article, we will explore <strong>step-by-step</strong> how to download files from an API in ReactJS using axios and blobs. We will cover:</p><ol><li>the necessary setup,</li><li>making the API request,</li><li>handling the response,</li><li>triggering the file download, and</li><li>cleaning up after the download.</li></ol><p>By the end of this tutorial, you will have a solid understanding of how to implement file downloading functionality in your ReactJS applications, empowering you to provide a seamless and efficient file download experience for your users.</p><h3>Necessary setup</h3><p>Setting up the project is the first step towards downloading files from an API in ReactJS using axios and blobs. Let&#39;s follow along to get started:</p><ol><li>Create a new ReactJS project or navigate to your existing project directory.</li><li>Open a terminal and run the following command to install axios:</li></ol><pre>npm install axios</pre><p>3. Once axios is installed, we can import it into our React component file:</p><pre>import axios from &#39;axios&#39;;</pre><p>4. Next, create a basic file structure for your project. We can organize your files in a way that suits your needs, but here’s a simple example:</p><pre>   src/<br>   ├── components/<br>   │   └── PDFDownloader.js<br>   └── App.js</pre><p>In this example, we have a FileDownloader component that will handle the PDF downloading functionality.</p><p>5. Open the FileDownloader.js file and start building your component. Here’s an example using a functional component:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0GgbheRXJV47EuNFrJHbsA.png" /></figure><p>Feel free to customize the component according to your requirements.</p><p>With these steps, we have set up the basic structure of our ReactJS project and imported the axios library. We are now ready to proceed with making API requests and downloading files using axios and blobs.</p><h3>Making the API request</h3><p>To make the API request, we can use the <strong>axios.get()</strong> method. Set the <strong>responseType option to ‘blob’</strong> to receive the file as a blob object. Here’s an example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yT8O6_5A-x8EE4KZ88OUog.png" /><figcaption>Asynchronous function to make the API call</figcaption></figure><p>In the above code snippet, we make an asynchronous function called downloadPDF, inside which we make a <strong>GET request</strong> to <em>‘</em><a href="https://exampleapi/getFile">https://ExampleAPI.com/getFile</a><em>&#39;</em> and specify the <em>responseType</em> as ‘<strong>blob’</strong>. The response can be accessed in the then block, where we can handle the file data accordingly. If there is an error, it can be caught in the catch block.</p><p>Now we have the file data, we can proceed to handle the API response and trigger the file download.</p><h3>Handling the API response</h3><p>When it comes to handling the API response for file downloading in ReactJS, we need to <strong>access the file data</strong> and <strong>create a blob URL</strong> from it. Here’s how we can do it:</p><ul><li>First, after making the API request using axios with the responseType set to ‘blob’, we can access the file data in the response using “ <strong>response.data “</strong>. This will give us a <strong>blob object</strong> representing the file.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TLxcNhtqrEspGHoKt8Ja8w.png" /><figcaption>Creating a blob from the response</figcaption></figure><ul><li>Next, we can <strong>create a blob URL</strong> from the file data using the <strong>URL.createObjectURL()</strong> method. This URL can be used to <strong>generate a download link or button</strong> in our React component.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7qKiiL06PPaGiigkUS1GDw.png" /><figcaption>create a temporary URL</figcaption></figure><ul><li>By following these steps, we can effectively handle the API response and access the file data in ReactJS. So our function now looks like this:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zTlrY1LRNFh_OS0kLf-2gw.png" /><figcaption>Function till now</figcaption></figure><h3>Triggering the file download</h3><ul><li>So to trigger the download we will make a button, which when clicked, will download the pdf to the user’s system. We can do it like this:</li></ul><pre>&lt;button onClick={downloadPDF}&gt;Download PDF&lt;/button&gt;</pre><ul><li>Now let’s make a temporary URL and an &lt;a&gt; tag which is going to trigger the download. Here we can also give the file a dynamic name or a generic name of the file. Then we have to append the &lt;a&gt; tag to the button and enable a click</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pNkLXqaiIzKUUycZFrrbsQ.png" /><figcaption>Temporary URL created</figcaption></figure><ul><li>Make sure to remove the link and url so that memory gets freed. Else as you keep adding more files, your website will become slower.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MDgNDiHgaFGRxqZiI5n9HA.png" /><figcaption>Cleaning up the a tag and the url</figcaption></figure><h3>Bonus: Full Code</h3><p>Hope you have not skipped the article and directly jumped here else you would not understand why we have done what we have done 😂</p><p>Even if you have, it’s alright as long as you understand. So here you go:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgaOWvUR94Ap0OXpyODjhw.png" /><figcaption>FileDownloader component</figcaption></figure><pre>import react from &#39;react&#39;;<br>import axios from &#39;axios&#39;;<br><br>const FileDownloader = () =&gt; {<br><br>  const downloadPdf = async () =&gt; {<br>      try {<br>        const response = await axios.get(<br>          &quot;https://ExampleAPI.com/getFile&quot;,<br>          {<br>            responseType: &quot;blob&quot;, <br>          }<br>        );<br><br>        // Create a Blob from the response data<br>        const pdfBlob = new Blob([response.data], { type: &quot;application/pdf&quot; });<br><br>        // Create a temporary URL for the Blob<br>        const url = window.URL.createObjectURL(pdfBlob);<br><br>        // Create a temporary &lt;a&gt; element to trigger the download<br>        const tempLink = document.createElement(&quot;a&quot;);<br>        tempLink.href = url;<br>        tempLink.setAttribute(<br>          &quot;download&quot;,<br>          `bill_${User_Id}_${date}.pdf`<br>        ); // Set the desired filename for the downloaded file<br><br>        // Append the &lt;a&gt; element to the body and click it to trigger the download<br>        document.body.appendChild(tempLink);<br>        tempLink.click();<br><br>        // Clean up the temporary elements and URL<br>        document.body.removeChild(tempLink);<br>        window.URL.revokeObjectURL(url);<br>      } catch (error) {<br>        console.error(&quot;Error downloading PDF:&quot;, error);<br>      }<br>    };<br><br>  return (<br>      &lt;button onClick={downloadPDF}&gt; Download PDF &lt;/button&gt;<br>  );<br>}<br><br>export default FileDownloader;</pre><p>Now you can render this component wherever you want. As per our file structure mentioned above, you can render it in App.js and it will work fine!</p><blockquote><em>💡</em> <strong>Pro Tip:</strong> For apps handling document downloads, streamline workflows by converting PDFs to editable formats with <a href="https://apryse.com/capabilities/conversion/pdf-to-office"><strong>Apryse PDF-to-Office Conversion</strong></a>. Perfect for scenarios requiring post-download editing or reuse.</blockquote><p><a href="https://apryse.com/capabilities/conversion/pdf-to-office">PDF to Office Conversion SDK | Apryse</a></p><h3>Conclusion</h3><p>In this article, I have provided a <strong>comprehensive guide</strong> on how to download PDFs from an API in ReactJS using axios and blobs.</p><p>We have covered the step-by-step process, including setting up the project, making the API request, handling the response, triggering the file download, and cleaning up after the download.</p><p>By following the code snippets and explanations provided, you should now have a solid understanding of how to <strong>implement file downloading functionality in your ReactJS applications</strong>. The combination of axios and blobs allows for a seamless and efficient file download experience for your users.</p><p>I encourage you to explore further and experiment with different approaches to enhance the file downloading process. Consider implementing error handling, applying best practices, and optimizing the performance of your application by exploring streaming or chunked downloads.</p><p>If you have any questions or would like to request guides on other functionalities, please leave a comment below. Your feedback is valuable, and I am always eager to provide content that meets your needs.</p><p>Thank you for reading, and happy coding!</p><p>Cheers 🥂</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a> | <a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a> | <a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a> | <a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a> | <a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://cofeed.app/"><strong>CoFeed</strong></a> | <a href="https://differ.blog/"><strong>Differ</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=699be8a27ca7" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/download-pdf-from-api-in-reactjs-using-axios-and-blobs-699be8a27ca7">Download PDF from API in React (Using Axios and blobs)</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Ultimate Guide to Consulting as a Side Hustle for Programmers in 2023]]></title>
            <link>https://medium.com/@subhanusroy/the-ultimate-guide-to-consulting-as-a-side-hustle-for-programmers-in-2023-eef25e43be57?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/eef25e43be57</guid>
            <category><![CDATA[passive-income]]></category>
            <category><![CDATA[consulting]]></category>
            <category><![CDATA[side-hustle]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[earn-money-online]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Sat, 28 Jan 2023 06:17:12 GMT</pubDate>
            <atom:updated>2023-01-28T06:17:12.440Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXXFRSszbDdIyiGcwFz_TA.png" /><figcaption>Consulting for Programmers</figcaption></figure><p>You can <strong>find the FREE full step by step comprehensive guide</strong> on <em>how to start consulting</em>, <em>how to get your first client</em>, <em>how to manage time </em>and much more <a href="https://subhanu.gumroad.com/l/ConsultingForProgrammersin2023FREE">here</a></p><p>As technology advances and the demand for programmers continues to grow, many are looking for ways to supplement their income and gain additional experience in the field.</p><p>Consulting as a side hustle can be the perfect solution for programmers who want to use their skills and knowledge to earn extra money, while also gaining valuable experience in a dynamic and flexible field.</p><h3>What is consulting?</h3><p>Consulting is a professional service where an expert provides advice and guidance to organizations and individuals in order to help them achieve their goals.</p><p>As a consultant, you will use your skills and knowledge to solve problems, make strategic decisions, and improve performance for your clients.</p><h3>Why is a side hustle necessary?</h3><p>With the current economic climate, many people are looking for ways to supplement their income and increase their earning potential.</p><p>A side hustle in consulting can be a great way for programmers to do just that, while also gaining valuable experience and building a valuable network of contacts in the industry.</p><h3>Why consulting?</h3><p>Consulting offers many benefits for programmers. It allows you to use your skills and knowledge to help others, while also earning extra money.</p><p>It also allows you to work on a flexible schedule, which can be especially helpful for those who have other commitments such as a full-time job or family.</p><p>Additionally, consulting can be a great way to gain additional experience and build a reputation in the industry, which can lead to new opportunities and career growth.</p><h3>How to get started?</h3><p>Getting started in consulting as a side hustle is relatively easy.</p><p>The first step is to identify your areas of expertise and create a portfolio that showcases your skills and experience.</p><p>Next, you will need to network and market yourself to potential clients. This can be done through online platforms such as LinkedIn, as well as through traditional networking events and referrals.</p><p>You can <strong>find the FREE full step by step comprehensive guide</strong> on <em>how to start consulting</em>, <em>how to get your first client</em>, <em>how to manage time </em>and much more <a href="https://subhanu.gumroad.com/l/ConsultingForProgrammersin2023FREE">here</a></p><p><strong>If you liked this article, do clap 👏 and follow me on </strong><a href="https://medium.com/@subhanu"><strong>Medium</strong></a></p><p><em>Follow me on </em><a href="https://twitter.com/the_indie_genie"><em>Twitter</em></a><em> where I write about</em></p><ul><li><em>how to </em><strong><em>earn a 2nd income online</em></strong></li><li><em>how to </em><strong><em>Build your SaaS</em></strong><em> and,</em></li><li><em>how to be </em><strong><em>productive and manage time</em></strong></li></ul><p>Can also check out some <strong>FREE gems 💎 </strong><a href="https://subhanu.gumroad.com/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eef25e43be57" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From Side Hustle to Full-time Income: How Freelancing as a Programmer Can Help You Achieve…]]></title>
            <link>https://medium.com/@subhanusroy/from-side-hustle-to-full-time-income-how-freelancing-as-a-programmer-can-help-you-achieve-19eedce99d1a?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/19eedce99d1a</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[online-income]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[side-hustle-tips]]></category>
            <category><![CDATA[freelance-developer]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 05:11:04 GMT</pubDate>
            <atom:updated>2023-01-26T05:11:04.964Z</atom:updated>
            <content:encoded><![CDATA[<h3>From Side Hustle to Full-time Income: How Freelancing as a Programmer Can Help You Achieve Financial Freedom</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68W9w4DhuzGhgaFq4uficA.png" /></figure><p>Freelancing is a way for individuals to <strong>work independently on a project-by-project basis</strong>, rather than being tied to a single employer or company.</p><p>It offers a great opportunity for programmers to use their skills and earn extra income as a side hustle.</p><p>In this article, we will explore why freelancing is a great option for programmers and how to get started.</p><h3>Why is a side hustle necessary?</h3><p>Having a side hustle can provide <strong>financial security and stability,</strong> especially in today’s uncertain job market.</p><p>It can also give you the opportunity to explore new skills and industries, and even turn your <strong>side hustle into a full-time</strong> career.</p><p>For programmers, freelancing can be a great way to <strong>supplement your income and gain experience</strong> working on different projects.</p><h3>Why freelancing?</h3><p>Freelancing offers many benefits for programmers.</p><p>It allows you to <strong>choose</strong> the projects you want to work on, set your <strong>own hours</strong> and <strong>work from anywhere</strong>.</p><p>It also allows you to <strong>charge a premium for your skills and experience</strong>, potentially earning more than you would as an employee.</p><p>Additionally, freelancing can provide a s<strong>ense of autonomy and creativity</strong> that can be difficult to find in a traditional work environment.</p><h3>How to get started?</h3><p>Getting started with freelancing as a programmer can seem daunting, but it’s not as difficult as you may think. Here are some steps to take to get started:</p><ol><li><strong>Identify your skills and experience</strong>. What programming languages and technologies are you proficient in? What types of projects have you worked on in the past? This will help you identify the types of projects you are best suited for.</li><li><strong>Create a portfolio</strong>. Showcase your work and skills through a portfolio website or LinkedIn profile. This will be key for getting your first clients.</li><li><strong>Network</strong>. Connect with other programmers and professionals in your industry. Attend meetups, join online groups, and participate in online forums. Networking can help you find potential clients and collaborators.</li><li><strong>Set your rates</strong>. Determine how much you want to charge for your services, keeping in mind your skills, experience and the market rate for similar services.</li><li><strong>Market yourself</strong>. Use social media, networking and online job platforms to market your services and find clients.</li></ol><h3>How much can you earn?</h3><p>The amount you can earn as a freelancer will depend on your skills, experience, and the types of projects you take on.</p><p>According to a recent survey, the <strong>average hourly rate</strong> for a freelance programmer is <strong>$61</strong>.</p><p>However, rates can range from <strong>$25 to $150 or more per hour</strong>.</p><p>So let’s do the math here.</p><p>Let’s assume you start off at $30/hr and you work for 10 hours a week.</p><p>That’s $300 a week.</p><p>There are 4 weeks in a month, so <strong>$1200 in a month</strong>.</p><p>That comes to about<strong> $14,400/yr</strong> from a side hustle!</p><p>And that is only the base rate.</p><p>Imagine how much you can earn when you start charging more after some initial clients 🤑</p><p>Keep in mind, that as a freelancer, you’ll be responsible for your own taxes and benefits.</p><h3>How to get your first client?</h3><p>Getting your first client can be the biggest hurdle when starting out as a freelancer. Here are some tips to help you get started:</p><ol><li><strong>Reach out to your network</strong>. Ask friends, family, and colleagues if they know anyone who needs programming services.</li><li><strong>Use online job platforms</strong>. There are many online platforms that connect freelancers with clients, such as Upwork, Freelancer, and Fiverr.</li><li><strong>Attend networking events</strong>. Attend meetups and networking events in your area to meet potential clients.</li><li><strong>Offer free services.</strong> Offer to do a small project for free or at a reduced rate to build your portfolio and get some experience.</li></ol><h3>How to manage time?</h3><p>Managing your time effectively is crucial when freelancing. Here are some tips to help you stay on top of your schedule:</p><ol><li><strong>Set clear goals.</strong> Determine what you want to achieve in a day, week or month and work towards them.</li><li><strong>Create a schedule.</strong> Plan your workday in advance and stick to your schedule as much as possible.</li><li><strong>Prioritize tasks</strong>. Focus on the most important tasks first, and then work on less important tasks.</li><li><strong>Eliminate distractions</strong>. Find a quiet place to work and eliminate any distractions that may take away from your productivity.</li><li><strong>Use time tracking tools</strong>. Use tools like Toggl or RescueTime to track how much time you spend on different tasks, so you can see where you may be wasting time.</li></ol><h3>Why patience is important?</h3><p>Starting a freelancing career can be challenging and it may take time to build a client base and establish yourself in the industry.</p><p>However, <strong>patience is key</strong>.</p><p>It takes time to find the right clients, build a reputation and establish yourself as a reputable freelancer.</p><p>Don’t get discouraged if you don’t get clients right away, keep marketing yourself, and eventually the clients will come.</p><h3>Conclusion</h3><p>Freelancing as a programmer can be a great way to supplement your income and gain experience working on different projects.</p><p>By identifying your skills, creating a portfolio, networking, setting your rates, and marketing yourself, you can get started on your freelancing journey. Managing your time and being patient are also key to success as a freelancer.</p><p>With hard work and determination, you can build a successful freelancing career as a programmer.</p><p><strong>If you liked this article, do clap 👏 and follow me on </strong><a href="https://medium.com/@subhanu"><strong>Medium</strong></a></p><p><em>Follow me on </em><a href="https://twitter.com/the_indie_genie"><em>Twitter</em></a><em> where I write about</em></p><ul><li><em>how to </em><strong><em>earn a 2nd income online</em></strong></li><li><em>how to </em><strong><em>Build your SaaS</em></strong><em> and,</em></li><li><em>how to be </em><strong><em>productive and manage time</em></strong></li></ul><p>Can also check out some <strong>FREE gems 💎 </strong><a href="https://subhanu.gumroad.com/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=19eedce99d1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[3 Best Side Hustles for programmers in 2023 — Maximize Your Earnings and Flexibility]]></title>
            <link>https://medium.com/@subhanusroy/3-best-side-hustles-for-programmers-in-2023-maximize-your-earnings-and-flexibility-6545d3ca174?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6545d3ca174</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[development]]></category>
            <category><![CDATA[freelance]]></category>
            <category><![CDATA[earn-money-online]]></category>
            <category><![CDATA[side-hustle]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 04:02:25 GMT</pubDate>
            <atom:updated>2023-01-26T06:03:33.654Z</atom:updated>
            <content:encoded><![CDATA[<h3>3 Best Side Hustles for programmers in 2023 — Maximize Your Earnings and Flexibility</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4dDOyutiApuY1LP1auRL6A.png" /></figure><p>As a programmer, you have a valuable set of skills that can be put to use in a variety of ways. One way to make the most of your abilities and <strong>earn extra money is to take on a side hustle</strong>.</p><p>In this article, we will explore what a side hustle is, why it’s necessary, and how much you can earn.</p><p>We will also introduce three side hustle ideas for programmers, and discuss the importance of patience and how ChatGPT can help.</p><h3>What is a Side Hustle?</h3><p>A side hustle is a way to <strong>earn extra money on the side</strong> of your primary job or career.</p><p>It is typically something that you do in your spare time, and it can take many forms, from starting a business to freelancing to investing in stocks.</p><p>The key is that it is something that you do in <strong>addition to your regular job</strong>, rather than as a replacement for it.</p><h3>Why is a Side Hustle Necessary?</h3><p>There are many reasons why a side hustle can be beneficial.</p><p>For one, it can give you a <strong>sense of purpose and fulfilment</strong> beyond your primary job.</p><p>Additionally, it can help you <strong>build new skills</strong>, <strong>network</strong> with new people, and <strong>earn extra money</strong>.</p><p>This can be especially important in today’s economy, where <strong>job security is not always guaranteed</strong>, and the cost of living is high, you will always have a backup plan.</p><h3>How Much Can You Earn?</h3><p>The amount of money you can earn from a side hustle will vary depending on the type of hustle you choose and how much time and effort you put into it.</p><p>However, with the right approach and a bit of patience, it is possible to earn a significant amount of extra money ($2k-$50k) each month.</p><h3>1st Side Hustle: Freelancing</h3><p>One of the most popular side hustles for programmers is freelancing.</p><p>This is because there is a <strong>high demand for programming skills</strong>, and you can easily find work online.</p><p>You can work on a variety of projects, such as <strong>building websites</strong>, creating mobile <strong>apps</strong>, or writing <strong>code</strong>.</p><p>To get started, you can create a <strong>portfolio of your work </strong>and market yourself on platforms like <strong>Upwork or Freelancer</strong>.</p><p>You can also build an audience on social media platforms like <strong>Twitter, Instagram,Reddit</strong> where you can talk about your work, how you can provide value and sell your skills, to get clients.</p><p>Once you get your first client, you can ask them to refer you to others and thus beginning a chain.</p><h3>2nd Side Hustle: Consulting</h3><p>Another side hustle that programmers can consider is consulting.</p><p>This can involve working with other companies to help them solve problems, improve their systems, or create new products.</p><p>You can also offer your expertise to start-ups, which often need help with technical issues. Many start-ups look for trained and experienced professionals to guide the developers on their team.</p><p>To get started, you can create a website, build a network of contacts, and market yourself on social media.</p><h3>3rd Side Hustle: Product Development</h3><p>A third side hustle that programmers can consider is product development.</p><p>This can involve creating your <strong>own software, mobile app</strong>, or other product that you can sell.</p><p>This can be a great way to monetize your skills and <strong>create something that you are passionate about</strong>.</p><p>To get started, you can brainstorm ideas, create a prototype, and market your product through various channels.</p><h3>How Can ChatGPT Help?</h3><p>ChatGPT can help with your side hustle by providing you with useful information and resources.</p><p>For example, it can help you research different side hustle ideas, create marketing materials, and even generate code.</p><p>Additionally, it can provide you with helpful tips and advice on how to be successful in your side hustle.</p><h3>Importance of Patience</h3><p>Starting a side hustle can take time and effort, and it’s important to have patience. It can take weeks or months to find the right opportunity, or to see results from your efforts. However, with patience and persistence, you can achieve your goals and earn those extra bucks (which can maybe replace your fulltime job)</p><h3>Conclusion</h3><p>In conclusion, taking on a side hustle as a programmer can be a great way to earn extra money, build new skills, and achieve a sense of fulfilment.</p><p>Whether you choose to freelance, consult, or develop your own product, there are many opportunities available for those with programming skills.</p><p>It’s important to have <strong>patience and persistence as you work towards your goals</strong> and remember that I am always here to help you with information and resources.</p><p><em>Follow me on </em><a href="https://twitter.com/the_indie_genie"><em>Twitter</em></a><em> where I write about</em></p><ul><li><em>how to earn a 2nd income online</em></li><li><em>how to Build your SaaS and,</em></li><li><em>how to be productive</em></li></ul><p>Can also check out some FREEbies <a href="https://subhanu.gumroad.com/">here</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6545d3ca174" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Typing Animation from a List of Phrases in React]]></title>
            <link>https://javascript.plainenglish.io/typing-animation-from-a-list-of-phrases-in-react-in-only-6-steps-c969955b0237?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/c969955b0237</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Wed, 24 Aug 2022 07:42:07 GMT</pubDate>
            <atom:updated>2022-08-25T11:20:59.436Z</atom:updated>
            <content:encoded><![CDATA[<p>You must have seen all those cool animations, where words just get automatically typed on a page? 🤔 Ever wondered how it’s done in React?</p><p>Here, I will guide you <strong>step by step</strong> into making a typing animation with an additional feature, where it <strong>chooses a phrase randomly every 2 seconds</strong> and types it. 😋</p><figure><img alt="Cool typing animation" src="https://cdn-images-1.medium.com/max/600/1*bVcqBrmyPciFn1GjWxveBw.gif" /></figure><h3>Prerequisites</h3><p>Basic knowledge of React Hooks like useState and useEffect.</p><h3>Step 1</h3><p>Import the hooks in the component, where you want the animation. Here, we will use <strong>useState</strong> and <strong>useEffect</strong> hooks.</p><figure><img alt="useEffect and useState hooks import" src="https://cdn-images-1.medium.com/max/1024/1*sNgaP3TTdD0bxa3gh_qggw.png" /></figure><h3>Step 2</h3><p>We will need one array to store the phrases we want to use, like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Inzq48YgHEIPG3moUInDdw.png" /></figure><p>Then we will need a few states, which are :</p><p><strong>text</strong>: current text that is displayed on the page</p><p><strong>fullText</strong>: final text we want to see</p><p><strong>index</strong>: This is the current index of the character that is being displayed on the page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AnYMzYo4xCCEjQXEgP5WaA.png" /></figure><h3>Step 3</h3><p>Now we need to write our typing animation logic.</p><p><strong>Logic</strong>: As <em>index</em> increases, we add the next character of <em>fullText</em> state to <em>text</em> state, which is finally displayed on our page.</p><p>We want to increase index say every 200 milliseconds, so we can do it using a timeout function (inbuilt in JS), which will be implemented like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*UHHrdgtsj4u4WT5goM7bBQ.png" /></figure><h3>Step 4</h3><p>Need to use the <strong>useEffect</strong> hook, to <strong>call the timeOut</strong> function every time the <strong>value of index changes</strong>.</p><p>So we check if the <strong>index is less than the length of the full text</strong>, before we proceed to animate. If index exceeds the length, then no need to animate further, as our fullText is already shown 😄</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*Kqe775IkiLftIgAAyO-MnQ.png" /></figure><h3>Step 5</h3><p>Change the fullText to <strong>randomly choose a phrase</strong> from our textList array.</p><p>This will only happen when the index exceeds the length of fullText (as only then then the previous fullText has been shown). So this will be the else condition 😋</p><p>Here, we need the length of our textList, so that we can <strong>choose a random index between 0 and l</strong> for our fullText.</p><figure><img alt="textList length" src="https://cdn-images-1.medium.com/max/704/1*hrYhgg9JGDklZ2fUFDTcDQ.png" /></figure><p>Now, what needs to be done to randomly choose a new phrase, every 2 seconds?</p><ol><li>We need to <strong>change the value of <em>text</em> state to empty</strong> (“ “)</li><li>We need to change the value of fullText to a <strong>random index position</strong> of textList.</li><li>We need to <strong>set the index to 0</strong> so that it starts from the initial position of the fullText.</li><li>We need to put all this <strong>inside a timeOut</strong> function which is triggered every 2 seconds</li></ol><figure><img alt="to randomly choose a phrase" src="https://cdn-images-1.medium.com/max/1024/1*N5kmLB7nWLWiHrUQC0Xi2A.png" /></figure><p>Put step 5 code <strong>inside the else condition of your useEffect</strong> hook, which you made in step 4.</p><figure><img alt="final useEffect" src="https://cdn-images-1.medium.com/max/1024/1*LxhU9DU1E_tnQjNmZTMhGw.png" /></figure><h3>Step 6</h3><p><strong>Render</strong> the text where you want it to display:</p><figure><img alt="text Div" src="https://cdn-images-1.medium.com/max/586/1*MnDSauwhGmrJDp35TowHYQ.png" /></figure><h3><strong>Final Code:</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TqH5ebMU2ZSawKCYZcT3SQ.png" /></figure><p>Voila! You have your cool typing animation. 🥳</p><p>Do follow me on <a href="https://medium.com/@subhanu12">Medium</a>! I write new articles every week about cool stuff using JavaScript. 😋</p><p><strong>PS:</strong> Do connect with me on <a href="https://www.linkedin.com/in/subhanu-sankar-roy">LinkedIn</a> and endorse my skills, if you liked this article. 🥰</p><p>Cheers! 🥂</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c969955b0237" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/typing-animation-from-a-list-of-phrases-in-react-in-only-6-steps-c969955b0237">Typing Animation from a List of Phrases in React</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[State Management using Context in Next.js]]></title>
            <link>https://javascript.plainenglish.io/state-management-using-context-in-nextjs-6929b8eeb5f8?source=rss-e65b1af744c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/6929b8eeb5f8</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[context-api]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Subhanu]]></dc:creator>
            <pubDate>Sat, 13 Aug 2022 09:24:45 GMT</pubDate>
            <atom:updated>2022-08-19T14:37:27.094Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*v3XndYeIsBtk4CkpMf7vmA.jpeg" /></figure><p>Whether you have used React and have done state management using Context API, or you have never tried it, this article will help you master the same. So let’s begin with the basics.</p><h4>What is State Management and why do we need it?</h4><p>You already know there are states in React and Next.js (a React-based framework).</p><p>Now, suppose you are making a Next app where you will need several different states and need to update those states.</p><p>If you have just one page, then you can simply <strong>update local states using the </strong><strong>useState hook</strong>.</p><p>Once you attempt to manage state across <strong>multiple components</strong>, things get a bit trickier.</p><p>You will reach a point in your application where patterns like “lifting state up” and passing callbacks down to update your state from components lead to lots and lots of props.</p><p><strong>What do you do if you want to update a component’s state from basically anywhere in your app?</strong> You turn it into <strong>global state</strong>.</p><p>This is where <em>State Management</em> comes in. And ContextAPI does wonders in this regard.</p><h4>Getting Started with Context</h4><p>In your <strong>root directory</strong> or the directory where you have your components or pages, make a <strong>new folder</strong> called <em>Context</em>.</p><p>Inside that, we will make our Context (<em>which is like a place to store all your global states</em>). In our example, we will be making a <strong>Company keyword search dashboard</strong>. So let’s call our Context as <em>SearchContext</em> and make a new file inside the Context folder called <strong>SearchContext.js</strong></p><h4>Import createContext and useState</h4><figure><img alt="import statements" src="https://cdn-images-1.medium.com/max/1024/1*XWH95OtZw6_TIL6DB0U8ug.png" /></figure><h4>Make the Context</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*TYfE46ZW5y4w3tN-k4xQmw.png" /></figure><h4>Make the ContextProvider</h4><p>This is like the function which will provide all your components with global states.</p><p>Create a <em>useState hook</em> for your global state, here we kept it compKeyword (short for company keyword).</p><p>Then return the SearchContext.Provider with the values as the states and its respective functions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sil-r2CtHS9o4hiAtq1oAQ.png" /></figure><h4>Final Look of SearchContext.js</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hQKQHIV4V810W_O4BB2cfw.png" /></figure><h4>Wrapping with the Provider in _app.js</h4><p>Now before you start using, you need to tell your Next.js app that, you have added a context and <strong>wrap your components with the Provider</strong>.</p><p><em>P.S Make sure to import the Provider like I’ve shown.</em></p><p>This is how you _app.js should look like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zuaZByvSs5U4vAburmEXMw.png" /></figure><h4>Using the Global State</h4><p>In whichever component you wish to use, just extract the global states you need like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dpVROssgSgRTVqMJ0SkbyA.png" /></figure><p>And then use them like you would use with local states. Here, we use it inside an input component.</p><figure><img alt="using in input box" src="https://cdn-images-1.medium.com/max/1024/1*_mDXb32NzNyJarLpfNEL5Q.png" /></figure><p>Voila! You’ve learnt how to use Context for State Management in Next.js.</p><p><em>More content at </em><a href="https://plainenglish.io/"><strong><em>PlainEnglish.io</em></strong></a><em>. Sign up for our </em><a href="http://newsletter.plainenglish.io/"><strong><em>free weekly newsletter</em></strong></a><em>. Follow us on </em><a href="https://twitter.com/inPlainEngHQ"><strong><em>Twitter</em></strong></a>, <a href="https://www.linkedin.com/company/inplainenglish/"><strong><em>LinkedIn</em></strong></a><em>, </em><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong><em>YouTube</em></strong></a><em>, and </em><a href="https://discord.gg/GtDtUAvyhW"><strong><em>Discord</em></strong></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6929b8eeb5f8" width="1" height="1" alt=""><hr><p><a href="https://javascript.plainenglish.io/state-management-using-context-in-nextjs-6929b8eeb5f8">State Management using Context in Next.js</a> was originally published in <a href="https://javascript.plainenglish.io/">JavaScript in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>