<?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 Dheerajjha on Medium]]></title>
        <description><![CDATA[Stories by Dheerajjha on Medium]]></description>
        <link>https://medium.com/@dheerajjha451?source=rss-59998ae7068e------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*U0ZGTSW_N6BQHDFXedtz2g.png</url>
            <title>Stories by Dheerajjha on Medium</title>
            <link>https://medium.com/@dheerajjha451?source=rss-59998ae7068e------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 15:04:40 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@dheerajjha451/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[Why It Is Crucial to Build a Waitlist to Test Your Idea]]></title>
            <link>https://medium.com/@dheerajjha451/why-it-is-crucial-to-build-a-waitlist-to-test-your-idea-f15e885e531b?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/f15e885e531b</guid>
            <category><![CDATA[ideas]]></category>
            <category><![CDATA[tech]]></category>
            <category><![CDATA[waitlist]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[mvp]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sun, 02 Feb 2025 16:21:24 GMT</pubDate>
            <atom:updated>2025-02-02T16:21:24.967Z</atom:updated>
            <content:encoded><![CDATA[<p>Most of us dream of building something of our own. We explore multiple ideas, but juggling a full-time 9–5 job makes it challenging to bring those ideas to life. Often, our ideas remain just that — ideas — never turning into actionable projects.</p><p>But what stops us from testing our ideas? Is it a lack of money? Or is it the fear that our idea may not have a market fit? Just because you believe in your idea doesn’t necessarily mean that customers will want it too. This is where building a waitlist becomes a game-changer.</p><h3>Why a Waitlist is Essential for Testing Your Idea</h3><p>Before investing time and money into building a full-fledged product, it is important to validate whether there is a genuine demand for your product. A waitlist helps you gauge interest, connect with potential customers, and refine your concept based on real feedback. Here’s how you can execute this effectively.</p><h3>Step-by-Step Process to Execute Your Idea</h3><h4>1. Understand Your Idea and Market Positioning</h4><p>The first step is to analyze your idea critically:</p><ul><li>What makes your idea unique?</li><li>How is it different from your competitors?</li><li>Is it truly a new idea, or are there already similar products in the market?</li></ul><p>Many people assume they have a unique idea simply because they haven’t seen it before. However, once you enter the market, you might find dozens of competitors working on the same thing. Identifying your unique value proposition (X-factor) is crucial before proceeding.</p><h4>2. Overcome the Fear of Idea Theft</h4><p>Many aspiring entrepreneurs worry that their idea will be copied. However, if your idea is so fragile that someone can easily replicate it, what’s stopping them from doing so once you launch it in the market? Execution and branding matter more than just the idea itself. The sooner you validate and refine your concept, the better your chances of success.</p><h4>3. Create a Waitlist Page and Promote Your Idea</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7QBqFhg6qmPiyFXJDu-4cw.png" /></figure><p>Building a waitlist page is a cost-effective way to validate demand before investing heavily in product development. Here’s what you should do:</p><ul><li>Set up a simple landing page explaining your product idea.</li><li>Use social media, email marketing, and online communities to promote your waitlist.</li><li>Run this campaign for at least 1–2 months to gather enough interest.</li></ul><h4>4. Analyze Feedback and Customer Interest</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9SQzrmqzfd73ckrJ5rZujA.png" /></figure><p>Once you start collecting sign-ups, analyze the response:</p><ul><li>Are people showing genuine interest in your product?</li><li>What feedback are they providing?</li><li>Are they willing to pay for your solution?</li></ul><p>If you receive 10–50 waitlist sign-ups, it’s a strong signal that you have potential customers who are interested in your offering.</p><h4>5. Develop a Minimum Viable Product (MVP)</h4><p>Instead of building a full-fledged product, start with an MVP:</p><ul><li>Develop a basic version with essential features.</li><li>Keep costs low while testing the market fit.</li><li>Continuously refine the product based on user feedback.</li></ul><p>Being in a beta phase allows you to improve the product before making a full-scale launch. This approach helps you minimize risks, save time, and ensure that your final product meets real customer needs.</p><h3>Final Thoughts</h3><p>If you want to test your idea and need help building your first MVP or setting up a waitlist — whether with or without customer support ai agent — we can assist you. Let’s turn your idea into a reality the right way!</p><p><strong>Need help building your waitlist or MVP? Get in touch today!</strong></p><p><strong>Work Sample: </strong><a href="https://salesly.live/">https://salesly.live/</a></p><p><a href="https://billy.designtocode.me/">Billy BETA</a></p><p>Portfolio: <a href="https://www.dheerajjha.co/">https://www.dheerajjha.co/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/692/1*8BDvOq5NLfkNk_lHK18JVQ.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f15e885e531b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use two VS Code in ubuntu]]></title>
            <link>https://medium.com/@dheerajjha451/use-two-vs-code-in-ubuntu-be514d0c47a2?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/be514d0c47a2</guid>
            <category><![CDATA[ubuntu]]></category>
            <category><![CDATA[developer]]></category>
            <category><![CDATA[vscode]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 17:28:55 GMT</pubDate>
            <atom:updated>2025-03-28T04:06:48.786Z</atom:updated>
            <content:encoded><![CDATA[<p>If you want to run <strong>two separate VS Code instances</strong> on Ubuntu, each tied to different GitHub accounts or workspaces, here’s how you can do it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ErOlg8xTGsSreISn" /><figcaption>Photo by <a href="https://unsplash.com/@cdr6934?utm_source=medium&amp;utm_medium=referral">Chris Ried</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>1. Install VS Code Stable and Insiders Versions</h3><p>You can run two versions of VS Code: the <strong>stable version</strong> and the <strong>Insiders version</strong>. They work independently and can have different settings, extensions, and configurations.</p><h4>Install VS Code Stable</h4><p>If you haven’t already:</p><pre>sudo apt update<br>sudo apt install wget gpg<br>wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor &gt; packages.microsoft.gpg<br>sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/<br>sudo sh -c &#39;echo &quot;deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main&quot; &gt; /etc/apt/sources.list.d/vscode.list&#39;<br>sudo apt install apt-transport-https<br>sudo apt update<br>sudo apt install code</pre><h4>Install VS Code Insiders</h4><p>For the Insiders version:</p><pre>wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor &gt; packages.microsoft.gpg<br>sudo install -o root -g root -m 644 packages.microsoft.gpg /usr/share/keyrings/<br>sudo sh -c &#39;echo &quot;deb [arch=amd64 signed-by=/usr/share/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/vscode stable main&quot; &gt; /etc/apt/sources.list.d/vscode.list&#39;<br>sudo apt update<br>sudo apt install code-insiders</pre><h3>2. Configure Separate Accounts</h3><p>Once installed, open each version and configure them for your workspaces.</p><h4>Stable Version (for Work)</h4><ol><li>Open VS Code Stable:</li></ol><pre>code</pre><p>2. Log in with your <strong>work GitHub account</strong> via the <strong>Source Control</strong> tab or command palette:</p><ul><li>Ctrl+Shift+P → &quot;Sign in with GitHub&quot;</li></ul><h4>Insiders Version (for Personal)</h4><ol><li>Open VS Code Insiders:</li></ol><pre>code-insiders</pre><p>2. Log in with your <strong>personal GitHub account</strong> in the same way.</p><h3>3. Use Different Settings and Extensions</h3><p>Each version will have independent:</p><ul><li>Extensions</li><li>Themes</li><li>Settings</li><li>Git configurations</li></ul><p>This separation helps you maintain personal and work environments in their own VS Code instances.</p><h3>4. Optional: Run Multiple Profiles in One VS Code</h3><p>If you prefer a single VS Code installation but with multiple profiles, you can do this:</p><h4>Create Profiles</h4><ol><li>Go to <strong>File &gt; Preferences &gt; Profiles &gt; Create Profile</strong>.</li><li>Create a profile for <strong>Work</strong> and another for <strong>Personal</strong>.</li><li>Switch profiles via the same menu.</li></ol><h4>Configure Profiles</h4><p>Each profile can have unique:</p><ul><li>Extensions</li><li>Settings</li><li>GitHub accounts</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be514d0c47a2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to Manage Two GitHub Accounts on Ubuntu]]></title>
            <link>https://medium.com/@dheerajjha451/how-to-manage-two-github-accounts-on-ubuntu-46f244775f8e?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/46f244775f8e</guid>
            <category><![CDATA[ssh-keys]]></category>
            <category><![CDATA[personal]]></category>
            <category><![CDATA[office]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[github]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Tue, 28 Jan 2025 17:19:19 GMT</pubDate>
            <atom:updated>2025-03-28T04:07:43.783Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*mo0DvXqomN_N_GMC" /><figcaption>Photo by <a href="https://unsplash.com/@synkevych?utm_source=medium&amp;utm_medium=referral">Roman Synkevych</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Managing two GitHub accounts (e.g., personal and work) on the same machine can be tricky, but it’s possible with proper SSH key configuration. Follow this step-by-step guide to set up and use multiple GitHub accounts on Ubuntu.</p><h3>Step 1: Check Existing SSH Keys</h3><p>Before generating new SSH keys, check if there are any existing keys on your system. Open a terminal and run:</p><pre>ls -al ~/.sh</pre><p>This will list all the SSH keys currently available in your system.</p><h3>Step 2: Generate SSH Keys for Personal and Work Accounts</h3><h3>Generate SSH Key for Personal GitHub</h3><p>Run the following command to create an SSH key for your personal GitHub account:</p><pre>ssh-keygen -t ed25519 -C &quot;your-personal-email@example.com&quot; -f ~/.ssh/id_rsa_personal</pre><p>When prompted for a passphrase, you can leave it empty or set one (recommended for security).</p><h3>Generate SSH Key for Work GitHub</h3><p>Similarly, generate an SSH key for your work GitHub account:</p><pre>ssh-keygen -t ed25519 -C &quot;your-office-email@example.com&quot; -f ~/.ssh/id_rsa_office</pre><p>Again, set a passphrase or leave it empty.</p><h3>Verify the Generated Keys</h3><p>To confirm the keys have been created, run:</p><pre>ls -la ~/.ssh</pre><p>You should see the following files:</p><ul><li>id_rsa_personal and id_rsa_personal.pub</li><li>id_rsa_office and id_rsa_office.pub</li></ul><h3>Step 3: Configure SSH for Multiple GitHub Accounts</h3><h3>Create or Edit the SSH Config File</h3><p>Open or create the SSH config file:nano ~/.ssh/config</p><pre>nano ~/.ssh/config</pre><h3>Add Configurations for Both Accounts</h3><p>Paste the following configuration into the file:</p><pre># Personal GitHub Account<br>Host github-personal<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_rsa_personal<br><br># Office GitHub Account<br>Host github-office<br>    HostName github.com<br>    User git<br>    IdentityFile ~/.ssh/id_rsa_office</pre><p><strong>Save and Exit</strong><br> Press Ctrl+O, then Enter, and Ctrl+X to save and exit.</p><p><strong>Set Correct Permissions</strong><br> Ensure the correct permissions for the config file:</p><pre>chmod 600 ~/.ssh/config</pre><h3>Step 4: Add SSH Keys to GitHub Accounts</h3><h3>Personal GitHub Account</h3><p>Copy the personal public key:</p><pre>cat ~/.ssh/id_rsa_personal.pub</pre><ul><li>Go to <strong>GitHub Settings</strong> &gt; <strong>SSH and GPG Keys</strong> &gt; <strong>New SSH Key</strong>.</li><li>Paste the key and save.</li></ul><h3>Work GitHub Account</h3><p>Copy the work public key:</p><pre>cat ~/.ssh/id_rsa_office.pub</pre><ul><li>Go to your work GitHub account’s <strong>Settings</strong> &gt; <strong>SSH and GPG Keys</strong> &gt; <strong>New SSH Key</strong>.</li><li>Paste the key and save.</li></ul><h3>Step 5: Test SSH Connections</h3><ol><li><strong>Test Personal Account</strong></li></ol><pre>ssh -T github-personal</pre><p>Expected output:</p><pre>Hi username! You&#39;ve successfully authenticated, but GitHub does not provide shell access.</pre><p><strong>2. Test Office Account</strong></p><pre>ssh -T github-office</pre><p>Expected output:</p><pre>Hi username! You&#39;ve successfully authenticated, but GitHub does not provide shell access.</pre><h3>Step 6: Clone Repositories with Correct SSH Config</h3><ol><li><strong>Clone Personal Repos</strong></li></ol><pre>git clone git@github-personal:your-username/your-repo.git</pre><p><strong>2. Clone Office Repos</strong></p><pre>git clone git@github-office:your-organization/your-repo.git</pre><h3>Step 7: Configure Git User for Each Repository</h3><ol><li><strong>Personal Repository</strong></li></ol><pre>git config user.name &quot;Your Personal GitHub Name&quot;<br>git config user.email &quot;your-personal-email@example.com&quot;</pre><p><strong>2. Office Repository</strong></p><pre>git config user.name &quot;Your Office GitHub Name&quot;<br>git config user.email &quot;your-office-email@example.com&quot;</pre><p><strong>3. Verify Configuration</strong><br> Check the settings in each repository:</p><pre>git config --get user.name<br>git config --get user.email</pre><p><a href="http://dheeraj-jha.tech/">Portfolio</a></p><p><a href="https://salesly.live/">Product</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=46f244775f8e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[1. What is HTML and Semantic Tags?]]></title>
            <link>https://medium.com/@dheerajjha451/1-what-is-html-and-semantic-tags-e1d230cb94e9?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/e1d230cb94e9</guid>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[startup]]></category>
            <category><![CDATA[typescript]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 04:55:20 GMT</pubDate>
            <atom:updated>2025-01-12T04:55:20.193Z</atom:updated>
            <content:encoded><![CDATA[<ul><li><strong>HTML (HyperText Markup Language)</strong> is the standard language used to create and structure content on the web. It uses tags to denote elements like text, images, links, and more.</li><li><strong>Semantic Tags</strong>: These are HTML5 tags that clearly define the purpose of the content. Examples include &lt;header&gt;, &lt;footer&gt;, &lt;article&gt;, and &lt;section&gt;. They improve readability and accessibility for both developers and browsers, and they are crucial for SEO (Search Engine Optimization) as search engines better understand the structure of the page.</li></ul><h3>2. How Semantic Tags Help in SEO?</h3><p>Semantic tags provide a meaningful structure to web pages. They help search engines understand which parts of the page are headers, footers, articles, etc. This enhances SEO by ensuring the site is indexed correctly and improving accessibility for screen readers.</p><h3>3. What are Attributes in HTML?</h3><p>Attributes provide additional information about HTML elements. They are always placed inside the opening tag and usually consist of a name and a value.</p><p><strong>Example</strong>:</p><pre>&lt;img src=&quot;image.jpg&quot; alt=&quot;A description of the image&quot; /&gt;</pre><p>Here, src and alt are attributes of the &lt;img&gt; tag.</p><h3>4. Difference between &lt;div&gt; and &lt;span&gt;</h3><ul><li><strong>&lt;div&gt;</strong>: Block-level element that takes up the full width of its container, starting on a new line.</li><li><strong>&lt;span&gt;</strong>: Inline element that only takes up as much width as necessary and does not start on a new line.</li></ul><h3>5. Example of Inline Tag</h3><p>Inline tags include elements like &lt;span&gt;, &lt;a&gt;, &lt;strong&gt;, and &lt;em&gt;.</p><p><strong>Example</strong>:</p><pre>&lt;p&gt;This is a &lt;span&gt;highlighted&lt;/span&gt; text.&lt;/p&gt;</pre><h3>6. Can We Give Height and Width to Inline Elements?</h3><p>By default, inline elements do not accept height or width properties. You need to set their display property to block or inline-block to modify their dimensions.</p><h3>7. Types of Inline Elements</h3><p>Some common inline elements are:</p><ul><li>&lt;a&gt;</li><li>&lt;span&gt;</li><li>&lt;img&gt;</li><li>&lt;strong&gt;</li><li>&lt;em&gt;</li></ul><h3>8. Difference between &lt;canvas&gt; and &lt;svg&gt; in HTML</h3><ul><li><strong>&lt;canvas&gt;</strong>: A bitmap-based drawing area. It is resolution-dependent and is generally used for drawing graphics via scripting (JavaScript).</li><li><strong>&lt;svg&gt;</strong>: A vector-based format. It is resolution-independent and describes images using XML, making it scalable without loss of quality.</li></ul><h3>9. Full Form of CSS</h3><p>CSS stands for <strong>Cascading Style Sheets</strong>. It is used to style and layout web pages.</p><h3>10. Meaning of Cascading in CSS</h3><p>Cascading refers to the way CSS rules are applied in the order of precedence. When multiple rules are applied to the same element, the rule with the highest specificity or the one that appears last takes precedence.</p><h3>11. Default Value of Position Property</h3><p>The default value of the position property is static, meaning the element follows the normal document flow.</p><h3>12. Difference between Relative and Absolute Position</h3><ul><li><strong>Relative Position</strong>: The element is positioned relative to its normal position. Other elements are not affected.</li><li><strong>Absolute Position</strong>: The element is positioned relative to its nearest positioned ancestor (an element with a position property other than static). It is removed from the document flow.</li></ul><h3>13. What is Flexbox?</h3><p>Flexbox is a CSS layout model designed to distribute space along a container’s main axis (either horizontal or vertical) and align items flexibly inside the container. It simplifies complex layouts with properties like justify-content, align-items, and flex-direction.</p><h3>14. What is Box Model?</h3><p>The box model represents how the browser calculates the size of an element. It includes:</p><ul><li><strong>Content</strong>: The actual content.</li><li><strong>Padding</strong>: Space around the content.</li><li><strong>Border</strong>: A border surrounding the padding.</li><li><strong>Margin</strong>: Space outside the border.</li></ul><h3>15. Default Value of Box Sizing</h3><p>The default value of box-sizing is content-box, which calculates the width/height of an element based on its content only, excluding padding and border.</p><h3>16. Difference between content-box and border-box</h3><ul><li><strong>content-box</strong>: The width/height only includes the content. Padding, border, and margin are not included.</li><li><strong>border-box</strong>: The width/height includes the content, padding, and border, but not the margin.</li></ul><h3>17. Why Do We Need JavaScript for Websites?</h3><p>JavaScript is used for adding interactivity and dynamic behavior to websites, such as responding to user input, fetching data, animations, and modifying HTML and CSS in real time.</p><h3>18. Different Data Types in JavaScript</h3><p>JavaScript has primitive data types like:</p><ul><li><strong>String</strong></li><li><strong>Number</strong></li><li><strong>Boolean</strong></li><li><strong>Null</strong></li><li><strong>Undefined</strong></li><li><strong>Symbol</strong></li><li><strong>BigInt</strong></li></ul><p>JavaScript also has non-primitive types:</p><ul><li><strong>Object</strong></li><li><strong>Array</strong></li><li><strong>Function</strong></li></ul><h3>19. Why Do We Need Two Types of Data Types?</h3><p>Primitive types are simple data types with fixed memory size, while non-primitive types (like objects) store collections of data and are reference types. The distinction allows for more flexible data handling.</p><h3>20. How to Declare Variables in JavaScript?</h3><p>Variables in JavaScript can be declared using:</p><ul><li><strong>var</strong>: Function-scoped, can be redeclared, and hoisted.</li><li><strong>let</strong>: Block-scoped and cannot be redeclared.</li><li><strong>const</strong>: Block-scoped and cannot be reassigned.</li></ul><h3>21. Difference between let, var, and const</h3><ul><li><strong>var</strong>: Function-scoped, can be redeclared and updated.</li><li><strong>let</strong>: Block-scoped, cannot be redeclared but can be updated.</li><li><strong>const</strong>: Block-scoped, cannot be redeclared or updated.</li></ul><h3>22. slice vs splice</h3><ul><li><strong>slice()</strong>: Returns a shallow copy of an array. It does not modify the original array.</li><li><strong>splice()</strong>: Adds/removes elements from an array and modifies the original array.</li></ul><h3>23. Why We Use Map Method in Array?</h3><p>The map() method creates a new array by applying a function to each element in the original array without modifying it.</p><p><strong>Example</strong>:</p><pre>const numbers = [1, 2, 3, 4];<br>const squares = numbers.map(num =&gt; num * 2);<br>console.log(squares); // [2, 4, 6, 8]</pre><h3>24. What are Promises?</h3><p>Promises represent the eventual completion (or failure) of an asynchronous operation. They allow you to write asynchronous code in a cleaner way than callbacks.</p><h3>25. What is DOM?</h3><p>DOM (Document Object Model) is an interface for manipulating HTML and XML documents as a tree structure where each node is an object representing a part of the document.</p><h3>26. Event Bubbling and Event Capturing</h3><ul><li><strong>Event Bubbling</strong>: The event starts from the target element and bubbles up to its parent elements.</li><li><strong>Event Capturing</strong>: The event starts from the outermost parent element and captures down to the target element.</li></ul><h3>27. Why Do We Need React?</h3><p>React is needed to build fast, scalable, and interactive user interfaces using a component-based architecture. It offers features like the virtual DOM, reusable components, and unidirectional data flow, which improve the development experience and performance.</p><h3>28. Difference between Declarative and Imperative in JS</h3><ul><li><strong>Declarative</strong>: You describe what should happen (e.g., React, map()).</li><li><strong>Imperative</strong>: You define how something should happen step by step (e.g., loops, DOM manipulation).</li></ul><h3>29. What is the Concept of State?</h3><p>State refers to the data that determines how a component renders and behaves. It can change over time and triggers re-rendering when updated.</p><h3>30. Why Do We Not Use Normal Variables in React?</h3><p>React requires controlled state management to re-render components when the state changes. Normal variables do not trigger a re-render, but using React’s useState hook allows state changes to re-render the component.</p><h3>31. What is Temporal Dead Zone?</h3><p>The Temporal Dead Zone refers to the period in which variables declared with let and const cannot be accessed before they are initialized. Attempting to access them results in a ReferenceError.</p><h3>32. Map, Filter, and Reduce</h3><ul><li><strong>map()</strong>: Creates a new array by applying a function to each element.</li><li><strong>filter()</strong>: Creates a new array with elements that pass the test provided by a function.</li><li><strong>reduce()</strong>: Reduces an array to a single value by applying a function cumulatively.</li></ul><h3>33. Example for Map, Filter, and Reduce</h3><pre>const numbers = [1, 2, 3, 4];</pre><pre>// Map<br>const doubled = numbers.map(num =const SearchBar = () =&gt; {<br>  // State to manage the user input<br>  const [inputValue, setInputValue] = useState(&#39;&#39;);</pre><pre>  // Use the useDebounce hook to get the debounced value<br>  const debouncedValue = useDebounce(inputValue, 500); // 500 milliseconds debounce delay</pre><pre>  // Integrate the debouncedValue in your component logic (e.g., trigger a search API call via a useEffect)</pre><pre>  return (<br>    &lt;input<br>      type=&quot;text&quot;<br>      value={inputValue}<br>      onChange={(e) =&gt; setInputValue(e.target.value)}<br>      placeholder=&quot;Search...&quot;<br>    /&gt;<br>  );<br>};</pre><pre>export default SearchBar;&gt; num * 2);</pre><pre>// Filter</pre><pre>const even = numbers.filter(num =&gt; num % 2 === 0);</pre><pre>// Reduce<br>const sum = numbers.reduce((acc, num) =&gt; acc + num, 0);</pre><pre>console.log(doubled); // [2, 4, 6, 8]<br>console.log(even);    // [2, 4]<br>console.log(sum);     // 10</pre><h3>34. In a String, Make the First Letter of Each Word Capital</h3><pre>const capitalize = str =&gt; {<br>  return str.split(&#39; &#39;).map(word =&gt; word.charAt(0).toUpperCase() + word.slice(1)).join(&#39; &#39;);<br>};</pre><pre>console.log(capitalize(&quot;hello world&quot;)); // Hello World</pre><h3>35. Make String to Array</h3><p>You can convert a string to an array using split().</p><pre>const str = &quot;hello world&quot;;<br>const arr = str.split(&#39; &#39;);<br>console.log(arr); // [&quot;hello&quot;, &quot;world&quot;]</pre><h3>36. Create a React App to Make a Todo List with Create and Delete Operation</h3><pre>import React, { useState } from &#39;react&#39;;</pre><pre>function TodoApp() {<br>  const [todos, setTodos] = useState([]);<br>  const [task, setTask] = useState(&quot;&quot;);</pre><pre>  const addTodo = () =&gt; {<br>    setTodos([...todos, task]);<br>    setTask(&quot;&quot;);<br>  };</pre><pre>  const deleteTodo = (index) =&gt; {<br>    setTodos(todos.filter((_, i) =&gt; i !== index));<br>  };</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;Todo List&lt;/h1&gt;<br>      &lt;input<br>        type=&quot;text&quot;<br>        value={task}<br>        onChange={(e) =&gt; setTask(e.target.value)}<br>      /&gt;<br>      &lt;button onClick={addTodo}&gt;Add Task&lt;/button&gt;<br>      &lt;ul&gt;<br>        {todos.map((todo, index) =&gt; (<br>          &lt;li key={index}&gt;<br>            {todo}<br>            &lt;button onClick={() =&gt; deleteTodo(index)}&gt;Delete&lt;/button&gt;<br>          &lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><pre>export default TodoApp;</pre><h3>1. console.log(‘5’ + 3)</h3><p>This will output &quot;53&quot;.</p><ul><li><strong>Explanation</strong>: The + operator in JavaScript can perform string concatenation if one of the operands is a string. Here, &#39;5&#39; is a string, so it concatenates &#39;5&#39; and 3, resulting in &#39;53&#39;.</li></ul><h3>2. console.log(‘5’ - 3)</h3><p>This will output 2.</p><ul><li><strong>Explanation</strong>: The operator always coerces the operands into numbers. So, &#39;5&#39; is converted to the number 5, and the operation becomes 5 - 3, which equals 2.</li></ul><h3>3. console.log(5 == ‘5’)</h3><p>This will output true.</p><ul><li><strong>Explanation</strong>: == is the loose equality operator, which converts the types of the operands to be the same. So, &#39;5&#39; (a string) is converted to the number 5, and 5 == 5 results in true.</li></ul><h3>4. console.log(5 === ‘5’)</h3><p>This will output false.</p><ul><li><strong>Explanation</strong>: === is the strict equality operator, which checks both the value and type. Since 5 is a number and &#39;5&#39; is a string, they are not strictly equal, so it returns false.</li></ul><h3>5. console.log(typeof NaN)</h3><p>This will output &quot;number&quot;.</p><ul><li><strong>Explanation</strong>: Despite its name (“Not a Number”), NaN is of type number in JavaScript.</li></ul><h3>6. Convert &quot;12&quot; into a Number</h3><p>You can convert a string to a number using Number(), parseInt(), or the unary + operator.</p><pre>console.log(Number(&quot;12&quot;));  // 12<br>console.log(parseInt(&quot;12&quot;));  // 12<br>console.log(+&quot;12&quot;);  // 12</pre><h3>7. console.log(NaN === NaN)</h3><p>This will output false.</p><ul><li><strong>Explanation</strong>: In JavaScript, NaN is not equal to anything, even itself. To check if a value is NaN, use isNaN() or Number.isNaN().</li></ul><h3>8. console.log(1 &lt; 2 &lt;3)</h3><p>In JavaScript, the expression console.log(1 &lt; 2 &lt; 3) can be a bit misleading due to how the language evaluates it.</p><h3>Explanation:</h3><ol><li>The expression 1 &lt; 2 &lt; 3 is evaluated from left to right.</li><li>First, 1 &lt; 2 is evaluated. This is true.</li><li>Then, true is compared to 3 in the expression true &lt; 3.</li><li>In JavaScript, true is converted to 1 when performing numerical comparisons.</li><li>So, the expression now becomes 1 &lt; 3, which is true.</li></ol><h3>Conclusion:</h3><p>The output of console.log(1 &lt; 2 &lt; 3) is true.</p><p>If you want to see the intended behavior, you should use parentheses to make the expression clearer:</p><pre>console.log(1 &lt; 2 &amp;&amp; 2 &lt; 3); // true</pre><p>This correctly checks if both conditions are true independently.</p><h3>9. console.log(3 &gt; 2 &gt; 1)</h3><p>This will output false.</p><ul><li><strong>Explanation</strong>: This is due to how JavaScript evaluates expressions from left to right. 3 &gt; 2 evaluates to true, and true &gt; 1 is false because true is coerced to 1, and 1 is not greater than 1.</li></ul><h3>10. User Click Changes Username from Array</h3><p>You can use JavaScript to change the username from an array of four names when a user clicks on an HTML element.</p><p><strong>Example</strong>:</p><pre>&lt;!DOCTYPE html&gt;<br>&lt;html lang=&quot;en&quot;&gt;<br>&lt;head&gt;<br>    &lt;title&gt;Change Username&lt;/title&gt;<br>&lt;/head&gt;<br>&lt;body&gt;<br>    &lt;div id=&quot;username&quot;&gt;Click me to change username!&lt;/div&gt;</pre><pre>    &lt;script&gt;<br>        const usernames = [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;, &quot;Diana&quot;];<br>        let index = 0;</pre><pre>        document.getElementById(&#39;username&#39;).addEventListener(&#39;click&#39;, function() {<br>            index = (index + 1) % usernames.length;<br>            this.innerText = usernames[index];<br>        });<br>    &lt;/script&gt;<br>&lt;/body&gt;<br>&lt;/html&gt;</pre><h3>11. What is HTTP? Difference between HTTP and HTTPS</h3><ul><li><strong>HTTP (Hypertext Transfer Protocol)</strong> is the protocol used for transferring data over the web. It is stateless and works on the application layer of the OSI model.</li><li><strong>HTTPS (HTTP Secure)</strong> is the secure version of HTTP. It encrypts the data exchanged between the server and the browser using SSL/TLS, ensuring confidentiality and security.</li></ul><p><strong>Differences</strong>:</p><ul><li><strong>Security</strong>: HTTPS is secure because it uses SSL/TLS encryption, while HTTP is not.</li><li><strong>Port</strong>: HTTP uses port 80, whereas HTTPS uses port 443.</li></ul><h3>12. Why Do We Use &lt;!DOCTYPE&gt; in HTML?</h3><p>The &lt;!DOCTYPE&gt; declaration defines the document type and version of HTML to the browser. It helps the browser to render the HTML correctly. In modern HTML, &lt;!DOCTYPE html&gt; is used to indicate HTML5.</p><h3>13. Why Do We Use Meta Tags in HTML?</h3><p>Meta tags provide metadata about the HTML document. They are placed inside the &lt;head&gt; tag and do not affect the visual presentation of the page. They are used for:</p><ul><li><strong>SEO</strong>: Define keywords, author, and description for search engines.</li><li><strong>Character Encoding</strong>: Set the character set (e.g., UTF-8).</li><li><strong>Viewport Settings</strong>: Configure how the page scales on mobile devices.</li></ul><p><strong>Example</strong>:</p><pre>&lt;meta charset=&quot;UTF-8&quot;&gt;<br>&lt;meta name=&quot;viewport&quot; content=&quot;width=device-width, initial-scale=1.0&quot;&gt;<br>&lt;meta name=&quot;description&quot; content=&quot;A brief description of the page&quot;&gt;</pre><h3>14. What Are Semantic Tags in HTML?</h3><p>Semantic tags are HTML5 elements that clearly describe their meaning in the context of the content. Examples include &lt;header&gt;, &lt;footer&gt;, &lt;article&gt;, &lt;section&gt;, and &lt;aside&gt;. These tags make the document more understandable for search engines and screen readers.</p><h3>15. Use of Head Tag in HTML</h3><p>The &lt;head&gt; tag in HTML contains metadata and links to external resources like CSS files and JavaScript. It can include:</p><ul><li>Title of the document (&lt;title&gt;)</li><li>Links to stylesheets (&lt;link&gt;)</li><li>Meta tags (&lt;meta&gt;)</li></ul><h3>16. Best Place to Put the CSS Link</h3><p>The best place to link your CSS file is inside the &lt;head&gt; section of your HTML document.</p><p><strong>Example</strong>:</p><pre>&lt;head&gt;<br>    &lt;link rel=&quot;stylesheet&quot; href=&quot;styles.css&quot;&gt;<br>&lt;/head&gt;</pre><h3>17. Difference between async and defer in &lt;script&gt; Tags</h3><ul><li><strong>async</strong>: The script is fetched and executed asynchronously with the rest of the page. The page does not wait for the script to finish loading.</li><li><strong>defer</strong>: The script is fetched asynchronously but executed after the HTML document has been fully parsed.</li></ul><h3>18. Why Do We Need JavaScript for Websites?</h3><p>JavaScript is essential for adding interactivity and dynamic behavior to websites. It allows you to:</p><ul><li>Manipulate the DOM (e.g., update the content dynamically)</li><li>Handle user events (e.g., clicks, form submissions)</li><li>Perform asynchronous tasks like fetching data from APIs</li></ul><h3>19. Difference between Slice and Splice</h3><ul><li><strong>slice()</strong>: Returns a shallow copy of a portion of an array. It does not modify the original array.</li><li><strong>splice()</strong>: Modifies the original array by removing or replacing elements.</li></ul><h3>20. What Are Promises?</h3><p>A <strong>Promise</strong> in JavaScript represents an asynchronous operation that can either resolve (succeed) or reject (fail). It is used for handling asynchronous tasks like data fetching.</p><p><strong>Example</strong>:</p><pre>const promise = new Promise((resolve, reject) =&gt; {<br>    setTimeout(() =&gt; {<br>        resolve(&quot;Data fetched&quot;);<br>    }, 1000);<br>});</pre><pre>promise.then(data =&gt; console.log(data)).catch(error =&gt; console.log(error));</pre><h3>21. What is DOM?</h3><p>DOM (Document Object Model) is a programming interface for HTML and XML documents. It represents the page as a tree structure, where each node is an object representing a part of the document.</p><h3>22. Event Bubbling and Event Capturing</h3><ul><li><strong>Event Bubbling</strong>: The event is first captured by the innermost element and propagates up to the outer elements.</li><li><strong>Event Capturing</strong>: The event is captured by the outermost element and propagates down to the target element.</li></ul><h3>23. Why Do We Need React?</h3><p>React is needed for building efficient, scalable, and dynamic user interfaces. It provides:</p><ul><li><strong>Component-based architecture</strong>: Makes it easy to build reusable UI components.</li><li><strong>Virtual DOM</strong>: Optimizes UI rendering by minimizing direct DOM manipulation.</li><li><strong>Unidirectional data flow</strong>: Simplifies state management.</li></ul><h3>24. Difference between Declarative and Imperative in JavaScript</h3><ul><li><strong>Declarative</strong>: You specify <em>what</em> you want to happen, and the underlying system handles the <em>how</em>.</li><li>Example: React, SQL</li><li><strong>Imperative</strong>: You explicitly define <em>how</em> something should happen.</li><li>Example: Direct DOM manipulation</li></ul><h3>25. What is the Concept of State in React?</h3><p>State is a built-in object in React components that holds dynamic data. When the state of a component changes, React automatically re-renders the component.</p><h3>26. Why Don’t We Use Normal Variables in React?</h3><p>Normal variables do not trigger a component re-render in React when updated. React’s useState hook or class component state ensures that when the state changes, the component re-renders.</p><h3>27. What is Temporal Dead Zone (TDZ)?</h3><p>TDZ is the period between when a variable is declared</p><p>with let or const and when it is initialized. Accessing the variable in this zone results in a ReferenceError.</p><h3>28. Example for Map, Filter, Reduce</h3><p>Here’s how you can use map, filter, and reduce:</p><pre>const numbers = [1, 2, 3, 4];</pre><pre>// Map<br>const doubled = numbers.map(num =&gt; num * 2);</pre><pre>// Filter<br>const even = numbers.filter(num =&gt; num % 2 === 0);</pre><pre>// Reduce<br>const sum = numbers.reduce((acc, num) =&gt; acc + num, 0);</pre><pre>console.log(doubled);  // [2, 4, 6, 8]<br>console.log(even);     // [2, 4]<br>console.log(sum);      // 10</pre><h3>29. Make the First Letter of Each Word Capital</h3><p>You can capitalize the first letter of each word in a string using split(), map(), and join():</p><pre>const capitalize = (str) =&gt; {<br>  return str.split(&#39; &#39;).map(word =&gt; word.charAt(0).toUpperCase() + word.slice(1)).join(&#39; &#39;);<br>};</pre><pre>console.log(capitalize(&quot;hello world&quot;));  // &quot;Hello World&quot;</pre><h3>30. Convert String to Array</h3><p>You can convert a string to an array using split():</p><pre>const str = &quot;hello world&quot;;<br>const arr = str.split(&#39; &#39;);<br>console.log(arr);  // [&quot;hello&quot;, &quot;world&quot;]</pre><h3>31. Create a React Todo List with Create and Delete Operations</h3><p>Here is an example React app for a simple todo list with create and delete operations:</p><pre>import React, { useState } from &#39;react&#39;;</pre><pre>function TodoApp() {<br>  const [todos, setTodos] = useState([]);<br>  const [task, setTask] = useState(&quot;&quot;);</pre><pre>  const addTodo = () =&gt; {<br>    setTodos([...todos, task]);<br>    setTask(&quot;&quot;);<br>  };</pre><pre>  const deleteTodo = (index) =&gt; {<br>    setTodos(todos.filter((_, i) =&gt; i !== index));<br>  };</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;h1&gt;Todo List&lt;/h1&gt;<br>      &lt;input<br>        type=&quot;text&quot;<br>        value={task}<br>        onChange={(e) =&gt; setTask(e.target.value)}<br>      /&gt;<br>      &lt;button onClick={addTodo}&gt;Add Task&lt;/button&gt;<br>      &lt;ul&gt;<br>        {todos.map((todo, index) =&gt; (<br>          &lt;li key={index}&gt;<br>            {todo}<br>            &lt;button onClick={() =&gt; deleteTodo(index)}&gt;Delete&lt;/button&gt;<br>          &lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><pre>export default TodoApp;</pre><p>Let me know if you’d like to dive deeper into any specific concepts or examples!1. What is HTML and Semantic Tags?</p><ul><li><strong>HTML (HyperText Markup Language)</strong> is the standard language used to create and structure content on the web. It uses tags to denote elements like text, images, links, and more.</li><li><strong>Semantic Tags</strong>: These are HTML5 tags that clearly define the purpose of the content. Examples include &lt;header&gt;, &lt;footer&gt;, &lt;article&gt;, and &lt;section&gt;. They improve readability and accessibility for both developers and browsers, and they are crucial for SEO (Search Engine Optimization) as search engines better understand the structure of the page.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e1d230cb94e9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[React Js Interview Questions]]></title>
            <link>https://medium.com/@dheerajjha451/react-js-interview-questions-d12a9152a32f?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/d12a9152a32f</guid>
            <category><![CDATA[interview]]></category>
            <category><![CDATA[frontend]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[technical-interview]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 04:49:19 GMT</pubDate>
            <atom:updated>2025-01-12T04:49:19.218Z</atom:updated>
            <content:encoded><![CDATA[<h3>1. What is React Router?</h3><p>React Router is a library in React used for managing and handling navigation between different views or pages in a web application. It allows you to define routes, which correspond to specific URLs, and map them to React components. React Router enables dynamic, client-side routing, which means the page does not need to reload when users navigate between views.</p><p>Key features:</p><ul><li><strong>Declarative Routing</strong>: You define routes declaratively within your app, making the code easier to understand.</li><li><strong>Nested Routes</strong>: You can have nested routing, allowing multiple layers of UI to be routed.</li><li><strong>Dynamic Routing</strong>: Route rendering is dynamic, and the URL updates automatically as the user navigates.</li></ul><p><strong>Example</strong>:</p><pre>import { BrowserRouter as Router, Route, Switch } from &#39;react-router-dom&#39;;</pre><pre>function App() {<br>  return (<br>    &lt;Router&gt;<br>      &lt;Switch&gt;<br>        &lt;Route path=&quot;/&quot; exact component={Home} /&gt;<br>        &lt;Route path=&quot;/about&quot; component={About} /&gt;<br>      &lt;/Switch&gt;<br>    &lt;/Router&gt;<br>  );<br>}</pre><h3>2. Difference between Functional and Class Components in React</h3><ul><li><strong>Functional Components</strong>: These are simple JavaScript functions that take props as an argument and return JSX. They were originally stateless but can now handle state and lifecycle events using Hooks (like useState, useEffect).</li><li><strong>Pros</strong>: Simpler, more readable, and easier to test.</li><li><strong>Cons</strong>: Initially, couldn’t handle state or lifecycle methods without hooks.</li><li><strong>Class Components</strong>: These are ES6 classes that extend React.Component and can maintain state and handle lifecycle methods (like componentDidMount).</li><li><strong>Pros</strong>: More feature-complete for earlier React versions.</li><li><strong>Cons</strong>: More complex syntax, especially with this keyword, and harder to maintain compared to functional components.</li></ul><p><strong>Example</strong>:</p><p><em>Functional Component:</em></p><pre>const Welcome = (props) =&gt; {<br>  return &lt;h1&gt;Hello, {props.name}&lt;/h1&gt;;<br>};</pre><p><em>Class Component:</em></p><pre>class Welcome extends React.Component {<br>  render() {<br>    return &lt;h1&gt;Hello, {this.props.name}&lt;/h1&gt;;<br>  }<br>}</pre><h3>3. How many Hooks are present in the Functional Component?</h3><p>React offers a variety of built-in hooks, and here are some of the most commonly used ones:</p><ul><li><strong>useState</strong>: Allows you to add state to a functional component.</li><li><strong>useEffect</strong>: Lets you perform side effects (data fetching, subscriptions).</li><li><strong>useContext</strong>: Lets you subscribe to React Context.</li><li><strong>useReducer</strong>: Alternative to useState for more complex state logic.</li><li><strong>useRef</strong>: Access DOM nodes directly.</li><li><strong>useMemo</strong> and <strong>useCallback</strong>: Memoize values and functions to optimize performance.</li></ul><p>There are additional hooks like useLayoutEffect, useImperativeHandle, and more, depending on the use case.</p><h3>4. What is the useEffect hook, and how is it used?</h3><p>useEffect is a hook in React that allows you to perform side effects in functional components. It combines the functionality of lifecycle methods such as componentDidMount, componentDidUpdate, and componentWillUnmount in class components. You use it for operations like fetching data, updating the DOM, or setting up subscriptions.</p><p><strong>Usage</strong>:</p><pre>useEffect(() =&gt; {<br>  // Perform side-effect here (e.g., fetch data)<br>  return () =&gt; {<br>    // Clean up when the component unmounts (e.g., cancel subscription)<br>  };<br>}, [dependencies]); // Only re-run the effect when dependencies change</pre><ul><li><strong>Empty dependency array (</strong><strong>[])</strong>: The effect runs only once (like componentDidMount).</li><li><strong>No dependency array</strong>: Runs after every render (like componentDidUpdate).</li></ul><h3>5. What is useState?</h3><p>useState is a hook that allows you to add state to functional components. It returns two values: the current state and a function to update it. You can use it to manage and update stateful logic inside your component.</p><p><strong>Example</strong>:</p><pre>const [count, setCount] = useState(0);</pre><pre>return (<br>  &lt;div&gt;<br>    &lt;p&gt;You clicked {count} times&lt;/p&gt;<br>    &lt;button onClick={() =&gt; setCount(count + 1)}&gt;<br>      Click me<br>    &lt;/button&gt;<br>  &lt;/div&gt;<br>);</pre><h3>6. Difference between Real DOM and Virtual DOM</h3><ul><li><strong>Real DOM</strong>: This is the actual representation of the document structure in HTML. Directly manipulating the Real DOM is slow and inefficient because every change triggers the browser to re-render the entire DOM, which impacts performance.</li><li><strong>Virtual DOM</strong>: A lightweight, in-memory representation of the Real DOM. React uses this to track changes in state. When a state changes, React calculates the minimal number of changes by comparing the new Virtual DOM with the previous one (via the <strong>Diffing Algorithm</strong>), and updates only the changed parts of the Real DOM.</li><li><strong>Benefits</strong>: It reduces loading time, improves performance, and optimizes re-rendering.</li></ul><h3>7. What are Props in React?</h3><p>Props (short for “properties”) are the way components pass data to one another. They are immutable and are passed from parent to child components, making components more reusable.</p><p><strong>Example</strong>:</p><pre>function Welcome(props) {<br>  return &lt;h1&gt;Hello, {props.name}&lt;/h1&gt;;<br>}</pre><p>Here, name is a prop passed to the Welcome component.</p><h3>8. How can we transfer data from child to parent component?</h3><p>In React, data is passed from a child to a parent component using a callback function. The parent component passes a function to the child component as a prop, and the child can call that function and pass data back to the parent.</p><p><strong>Example</strong>:</p><pre>function ParentComponent() {<br>  const handleDataFromChild = (data) =&gt; {<br>    console.log(data);<br>  };</pre><pre>  return &lt;ChildComponent sendData={handleDataFromChild} /&gt;;<br>}</pre><pre>function ChildComponent({ sendData }) {<br>  return &lt;button onClick={() =&gt; sendData(&#39;Hello from child!&#39;)}&gt;Send Data&lt;/button&gt;;<br>}</pre><p>Let me know if you’d like to dive deeper into any of these topics!</p><p>Here’s a detailed explanation and sample code for each of the topics you’ve asked about:</p><h3>1. Why do we need React?</h3><p>React is a JavaScript library developed by Facebook that is used for building user interfaces, especially for single-page applications (SPAs). We need React because:</p><ul><li><strong>Component-based architecture</strong>: It allows developers to create reusable components, making the code modular and easier to maintain.</li><li><strong>Virtual DOM</strong>: React optimizes the updates to the DOM, improving the performance of the application.</li><li><strong>Unidirectional data flow</strong>: React’s one-way data binding ensures a predictable state and makes debugging easier.</li><li><strong>Fast rendering</strong>: React’s use of a virtual DOM ensures quick updates, even in complex interfaces.</li></ul><h3>2. What is Virtual DOM?</h3><p>The <strong>Virtual DOM</strong> is a lightweight copy of the real DOM that React uses to keep track of changes in the application. Instead of manipulating the real DOM directly, React updates the Virtual DOM first and then compares it with the actual DOM using a process called “diffing.” Once the differences are identified, only the parts of the real DOM that have changed are updated.</p><h3>3. How Virtual DOM resembles the Real DOM?</h3><ul><li><strong>Structure</strong>: The Virtual DOM has the same structure as the real DOM. It contains objects representing nodes and elements.</li><li><strong>Abstraction</strong>: While the real DOM represents actual elements in the browser, the Virtual DOM is an in-memory abstraction that allows React to efficiently calculate differences.</li></ul><h3>4. Why is Virtual DOM faster?</h3><p>The Virtual DOM is faster because:</p><ul><li><strong>Efficient updates</strong>: Instead of re-rendering the entire DOM, React calculates the minimum number of changes using the <strong>diffing algorithm</strong> and updates only those parts of the real DOM that have changed.</li><li><strong>Batch updates</strong>: React batches updates to the DOM, reducing the number of reflows and repaints, which improves performance.</li></ul><h3>5. Difference between State and useState</h3><ul><li><strong>State</strong>: In class components, state is an object that holds the component’s dynamic data, which can be updated with setState().</li><li><strong>useState</strong>: In functional components, useState is a hook that allows you to add state to the component. It returns two values: the current state and a function to update it.</li></ul><p><strong>Example:</strong></p><pre>// Class Component<br>class MyComponent extends React.Component {<br>  state = { count: 0 };</pre><pre>  increment = () =&gt; {<br>    this.setState({ count: this.state.count + 1 });<br>  };<br>}</pre><pre>// Functional Component<br>const MyComponent = () =&gt; {<br>  const [count, setCount] = useState(0);</pre><pre>  const increment = () =&gt; {<br>    setCount(count + 1);<br>  };<br>};</pre><h3>6. Difference between useState and Props</h3><ul><li><strong>useState</strong>: Manages the internal state of a component. The state can be updated within the component itself.</li><li><strong>Props</strong>: Data passed from parent to child components. Props are immutable, meaning the child component cannot modify them.</li></ul><h3>7. Ways to Create State</h3><p>There are several ways to create and manage state in React:</p><ul><li><strong>useState Hook</strong> (Functional components): Manages local component state.</li><li><strong>Class Component State</strong>: Managed using the state object and setState method.</li><li><strong>useReducer Hook</strong>: For more complex state logic where you might need actions and reducers (similar to Redux).</li></ul><p><strong>Example:</strong></p><pre>const [state, dispatch] = useReducer(reducer, initialState);</pre><h3>8. How to Track if State has Changed?</h3><ul><li><strong>useEffect Hook</strong>: You can use the useEffect hook to track changes in a particular state. By specifying the state variable in the dependency array, the useEffect will be triggered whenever the state changes.</li></ul><p><strong>Example:</strong></p><pre>useEffect(() =&gt; {<br>  console.log(&quot;State changed:&quot;, state);<br>}, [state]); // This effect will run when &#39;state&#39; changes</pre><h3>9. Why is Vite faster than Create React App (CRA)?</h3><ul><li><strong>ESM (ECMAScript Module)</strong>: Vite uses native ES modules for faster builds and efficient bundling.</li><li><strong>Hot Module Replacement (HMR)</strong>: Vite offers a significantly faster Hot Module Replacement (HMR), which improves developer experience.</li><li><strong>No bundling during development</strong>: Vite doesn’t bundle the entire app during development, allowing it to start faster compared to CRA, which uses Webpack for bundling.</li></ul><h3>10. Why does CRA use Webpack?</h3><p>Create React App (CRA) uses Webpack because:</p><ul><li><strong>Bundling</strong>: Webpack bundles all the JavaScript files into a single file or multiple chunks, which reduces HTTP requests and ensures efficient loading.</li><li><strong>Hot Module Replacement (HMR)</strong>: It allows developers to see changes instantly during development.</li><li><strong>Asset management</strong>: Webpack handles the loading of assets like images, CSS, and JavaScript, making the app more efficient.</li></ul><h3>11. What are Source Maps?</h3><p>Source maps are files that map the minified or transpiled code back to the original source code. This makes it easier to debug JavaScript applications because you can trace errors back to the actual line of code in your development files, even though the browser is running the minified version.</p><h3>12. What are Hooks in React?</h3><p>Hooks are functions that let you use state and other React features in functional components. They allow you to do things like manage state (useState), manage side effects (useEffect), and more, without needing to use class components.</p><h3>13. Code Example for using a Hook</h3><pre>import React, { useState, useEffect } from &#39;react&#39;;</pre><pre>function Counter() {<br>  const [count, setCount] = useState(0);</pre><pre>  useEffect(() =&gt; {<br>    document.title = `You clicked ${count} times`;<br>  }, [count]); // Only re-run the effect when count changes</pre><pre>  return (<br>    &lt;div&gt;<br>      &lt;p&gt;You clicked {count} times&lt;/p&gt;<br>      &lt;button onClick={() =&gt; setCount(count + 1)}&gt;Click me&lt;/button&gt;<br>    &lt;/div&gt;<br>  );<br>}</pre><h3>14. Why using async in useEffect shows an error</h3><p>useEffect itself cannot be asynchronous. However, if you want to perform an asynchronous operation inside it (like data fetching), you can define an async function inside the effect and then call it.</p><p><strong>Solution</strong>:</p><pre>useEffect(() =&gt; {<br>  const fetchData = async () =&gt; {<br>    const result = await fetch(&#39;&lt;https://api.example.com/data&gt;&#39;);<br>    // Handle result<br>  };</pre><pre>  fetchData();<br>}, []); // [] ensures it runs once</pre><h3>15. Implement Cursor Move with useRef</h3><p>useRef is useful for accessing DOM elements directly. Here&#39;s an example of tracking mouse cursor movement:</p><p><strong>Example</strong>:</p><pre>import React, { useRef, useEffect } from &#39;react&#39;;</pre><pre>function CursorMove() {<br>  const cursorRef = useRef();</pre><pre>  useEffect(() =&gt; {<br>    const handleMouseMove = (e) =&gt; {<br>      if (cursorRef.current) {<br>        cursorRef.current.style.left = `${e.pageX}px`;<br>        cursorRef.current.style.top = `${e.pageY}px`;<br>      }<br>    };</pre><pre>    window.addEventListener(&#39;mousemove&#39;, handleMouseMove);</pre><pre>    return () =&gt; window.removeEventListener(&#39;mousemove&#39;, handleMouseMove);<br>  }, []);</pre><pre>  return &lt;div ref={cursorRef} style={{ position: &#39;absolute&#39;, width: &#39;10px&#39;, height: &#39;10px&#39;, backgroundColor: &#39;red&#39; }} /&gt;;<br>}</pre><pre>export default CursorMove;</pre><p>In this example, the useRef hook is used to keep a reference to the cursor DOM element. The mousemove event handler moves the element as the user moves the cursor.</p><ol><li>Difference between useRef and useState?</li></ol><p>The main difference between useRef and useState in React lies in how they manage data and trigger component re-renders. Here&#39;s a breakdown of each:</p><h3>useRef</h3><ul><li><strong>Purpose</strong>: Used to create a reference to DOM elements or to persist mutable values that don’t trigger a re-render when updated.</li><li><strong>Behavior</strong>:</li><li>It returns a mutable object (ref.current) that persists across renders but changing it doesn&#39;t cause the component to re-render.</li><li>Commonly used to reference DOM elements, like focusing an input field or interacting with third-party libraries.</li><li>Can also store any value (like a flag or counter) that you want to keep between renders without causing a re-render.</li><li><strong>Example</strong>:</li></ul><pre>import { useRef } from &#39;react&#39;;<br><br>function InputFocus() {<br>  const inputRef = useRef(null);<br><br>  const handleClick = () =&gt; {<br>    inputRef.current.focus();  // Focuses the input field<br>  };<br><br>  return (<br>    &lt;&gt;<br>      &lt;input ref={inputRef} type=&quot;text&quot; /&gt;<br>      &lt;button onClick={handleClick}&gt;Focus Input&lt;/button&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><p>useState</p><ul><li><strong>Purpose</strong>: Used to store and manage state values that trigger re-renders when changed.</li><li><strong>Behavior</strong>:</li><li>It returns a state value and a function to update it.</li><li>When the update function is called, React schedules a re-render, and the updated state is reflected in the UI.</li><li><strong>Example</strong>:</li></ul><pre>import { useState } from &#39;react&#39;;<br><br>function Counter() {<br>  const [count, setCount] = useState(0);<br><br>  const handleIncrement = () =&gt; {<br>    setCount(count + 1);  // Causes re-render<br>  };<br><br>  return (<br>    &lt;&gt;<br>      &lt;p&gt;Count: {count}&lt;/p&gt;<br>      &lt;button onClick={handleIncrement}&gt;Increment&lt;/button&gt;<br>    &lt;/&gt;<br>  );<br>}</pre><h3>Key Differences:</h3><ul><li><strong>Re-rendering</strong>:</li><li>useRef does not cause re-renders when its value changes.</li><li>useState does trigger re-renders when the state value changes.</li><li><strong>Usage</strong>:</li><li>Use useRef when you need to persist data between renders but don’t want to cause re-renders (e.g., referencing DOM elements or holding non-UI state).</li><li>Use useState when you need to manage and reflect dynamic state changes in the UI.</li></ul><p>In short, use useRef for references and non-render-triggering data, and use useState for managing state that directly affects the UI.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d12a9152a32f" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PollyFills Using TypeScript: Interview Questions]]></title>
            <link>https://medium.com/@dheerajjha451/pollyfills-using-typescript-interview-questions-384e87ab92b9?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/384e87ab92b9</guid>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[pollyfills]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[interview-questions]]></category>
            <category><![CDATA[interview]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sun, 12 Jan 2025 04:42:36 GMT</pubDate>
            <atom:updated>2025-01-12T04:42:36.105Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><strong>PollyFill: </strong><em>A polyfill is a piece of code (usually JavaScript on the Web) used to provide modern functionality on older browsers that do not natively support it.</em></blockquote><ol><li>Filter</li></ol><pre>interface Array&lt;T&gt; {<br>  myOwnFilter(callback: (element: T, index: number) =&gt; boolean): T[];<br>}<br><br>Array.prototype.myOwnFilter = function &lt;T&gt;(callback: (element: T, index: number) =&gt; boolean): T[] {<br>  let newArr: T[] = [];<br>  this.forEach((element: T, index: number) =&gt; {<br>    if (callback(element, index)) {<br>      newArr.push(element);<br>    }<br>  });<br>  return newArr;<br>};<br><br>let arr: number[] = [1, 3, 2, 4, 9, 5, 8, 6];<br><br>const arrayFiltered = arr.myOwnFilter((element, index) =&gt; {<br>  return element &gt; 4;<br>});<br><br>console.log(arrayFiltered);</pre><p>2. For Each</p><pre>interface Array&lt;T&gt; {<br>  myForEach(callback: (element: T, index: number) =&gt; void): void;<br>}<br><br>Array.prototype.myForEach = function &lt;T&gt;(callback: (element: T, index: number) =&gt; void): void {<br>  for (let i = 0; i &lt; this.length; i++) {<br>    callback(this[i], i);<br>  }<br>};<br><br>const arr: number[] = [1, 2, 3, 4, 5];<br><br>arr.myForEach((element, index) =&gt; {<br>  console.log(`Element at index ${index}: ${element}`);<br>});</pre><p>3. Map</p><pre>interface Array&lt;T&gt; {<br>  myOwnMap&lt;U&gt;(callback: (element: T, index: number) =&gt; U): U[];<br>  myOwnReduce(callback: (accumulator: T, currentValue: T, index?: number, array?: T[]) =&gt; T, initialValue?: T): T;<br>}<br><br>Array.prototype.myOwnMap = function &lt;T, U&gt;(callback: (element: T, index: number) =&gt; U): U[] {<br>  const newArr: U[] = [];<br><br>  this.forEach((element: T, index: number) =&gt; {<br>    const result = callback(element, index);<br>    newArr.push(result);<br>  });<br><br>  return newArr;<br>};<br><br>const arr = [1, 3, 2, 4, 9, 5, 8, 6];<br><br>const arrayMap = arr.myOwnMap((element, index) =&gt; {<br>  return element * 5;<br>});<br><br>console.log(&quot;Mapped Array:&quot;, arrayMap);<br><br></pre><p>4. Reduce</p><pre>interface Array&lt;T&gt; {<br>  myOwnReduce&lt;U&gt;(<br>    callback: (accumulator: U, currentValue: T, index: number, array: T[]) =&gt; U,<br>    initialValue?: U<br>  ): U;<br>}<br><br>Array.prototype.myOwnReduce = function &lt;T, U&gt;(<br>  this: T[],<br>  callback: (accumulator: U, currentValue: T, index: number, array: T[]) =&gt; U,<br>  initialValue?: U<br>): U {<br>  if (this.length === 0 &amp;&amp; initialValue === undefined) {<br>    throw new TypeError(&quot;Reduce of empty array with no initial value&quot;);<br>  }<br><br>  let accumulator: U = initialValue !== undefined ? initialValue : (this[0] as unknown as U);<br>  const startIndex = initialValue !== undefined ? 0 : 1;<br><br>  for (let i = startIndex; i &lt; this.length; i++) {<br>    accumulator = callback(accumulator, this[i], i, this);<br>  }<br><br>  return accumulator;<br>};<br><br><br>const arr = [1, 2, 3, 4];<br>const sum = arr.myOwnReduce&lt;number&gt;((accumulator, currentValue) =&gt; {<br>  return accumulator + currentValue;<br>}, 0);<br><br>console.log(&quot;Reduced Sum:&quot;, sum); </pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=384e87ab92b9" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Git Skills Do You Need to Work in a Company?]]></title>
            <link>https://medium.com/@dheerajjha451/what-git-skills-do-you-need-to-work-in-a-company-43bc3e3f2e17?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/43bc3e3f2e17</guid>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[experience]]></category>
            <category><![CDATA[jobs]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sat, 14 Sep 2024 08:47:10 GMT</pubDate>
            <atom:updated>2024-09-14T08:47:10.133Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="What Git Skills Do You Need to Work in a Company?" src="https://cdn-images-1.medium.com/max/1024/1*cC54WGEdE2_mzViJgSGtLA.jpeg" /><figcaption>What Git Skills Do You Need to Work in a Company?</figcaption></figure><h3>Understanding Git Branching</h3><h3>What is a Git Branch?</h3><p>A Git branch is a pointer to a specific snapshot of your repository, allowing you to work on different parts of a project independently. Each branch can exist independently, enabling parallel development and collaboration without affecting the main codebase.</p><h3>Types of Branches: Main, Feature, and Hotfix</h3><ol><li><strong>Main Branch (e.g., </strong><strong>main, </strong><strong>master)</strong>: The main branch is the default branch in a Git repository and holds the stable, production-ready code.</li><li><strong>Feature Branch</strong>: Created to develop a specific feature or functionality. It allows developers to work on isolated changes without affecting the main branch.</li><li><strong>Hotfix Branch</strong>: Used for urgent fixes in the production environment. Hotfix branches are created from the main branch and merged back into it after the fix is applied.</li></ol><h3>Best Practices for Creating and Managing Branches</h3><ul><li>Use descriptive names for branches (e.g., feature/login-form, hotfix/server-crash).</li><li>Keep branches focused on a single feature or task.</li><li>Regularly sync feature branches with the main branch to minimize conflicts.</li><li>Delete branches after merging them to keep the repository clean.</li></ul><h3>How Git Branching Works in Teams</h3><h3>Collaboration Using Branches</h3><p>In a team setting, each developer works on their own branch, which can later be merged into a shared branch (like main or develop). This approach prevents code conflicts and allows simultaneous development without disruptions.</p><h3>Tracking Changes Across Multiple Branches</h3><p>Git allows you to easily track changes by showing differences between branches. You can use git diff to view changes or git log to track the commit history across branches.</p><h3>Merging Branches Without Conflicts</h3><p>Before merging branches, it’s important to pull the latest changes from the remote repository and resolve any conflicts locally. Tools like git merge and git rebase help integrate changes, but best practices for conflict prevention include keeping feature branches up to date and making small, frequent commits.</p><h3>Configuring Multiple Emails in Git</h3><h3>Using Different Emails for Work and Personal Projects</h3><p>You might want to use different email addresses for different repositories — one for work projects and another for personal projects. Git allows you to configure multiple email addresses at the repository level.</p><h3>Configuring Git to Handle Two Emails</h3><p>To set different emails for different repositories:</p><pre>git config user.email &quot;work_email@example.com&quot;  # for work repo<br>git config user.email &quot;personal_email@example.com&quot;  # for personal repo</pre><h3>Verifying Email Configuration in Commits</h3><p>To check the email associated with your commits, use the following command:</p><pre>git log --format=&#39;%ae&#39;</pre><p>This will display a list of emails used for each commit.</p><p><strong>Using GitHub Commit URL:</strong></p><ul><li>You can view the commit details by appending .patch to the commit URL:</li></ul><pre>https://github.com/{username}/{repository}/commit/{commit_hash}.patch</pre><p><strong>Example:</strong></p><pre>https://github.com/Dheerajjha451/Design2Code/commit/be7b187393e120e853a68b060c121ddea199f7de.patch</pre><h3>Resolving Git Conflicts</h3><h3>What Causes Merge Conflicts?</h3><p>Merge conflicts occur when changes are made to the same line in the same file on two different branches. Conflicts can also arise when one branch deletes a file that the other modifies.</p><h3>Steps to Resolve Conflicts Using Git Commands</h3><ol><li>Identify conflicts using git status.</li><li>Open the conflicting files and manually resolve conflicts by choosing which changes to keep.</li><li>After resolving, add the resolved files using git add &lt;file&gt;.</li><li>Complete the merge with git commit.</li></ol><h3>Tools to Simplify Conflict Resolution in Git</h3><p>Many IDEs have built-in Git conflict resolution tools. You can also use external tools like:</p><ul><li><strong>VS Code</strong>: Provides a visual interface for conflict resolution.</li><li><strong>KDiff3</strong>: A cross-platform merge tool.</li><li><strong>GitKraken</strong>: A Git GUI with powerful conflict management.</li></ul><h3>Steps to Follow Before Creating a Pull Request (PR)</h3><h3>Reviewing Code Changes Locally</h3><p>Use git diff to review changes in your working directory before creating a PR. This helps you ensure that your changes are as expected.</p><h3>Fetching the Latest Changes from the Remote Repository</h3><p>Before creating a PR, always pull the latest changes from the remote repository:</p><pre>git fetch origin<br>git rebase origin/main</pre><h3>Rebase vs. Merge: Which Should You Use?</h3><ul><li><strong>Rebase</strong>: Rewrites the commit history, creating a cleaner and linear history.</li><li><strong>Merge</strong>: Combines changes and creates a new merge commit. This is simpler but can lead to more complex history.</li></ul><h3>Testing Your Code Before Pushing</h3><p>Always run tests locally and ensure that your code is working as expected before pushing it to a remote branch.</p><h3>How to Assign a PR for Review</h3><h3>Assigning the PR to a Maintainer</h3><p>When opening a PR, assign it to a project maintainer or reviewer who is responsible for code review and approval.</p><h3>Using GitHub, GitLab, or Bitbucket to Notify Reviewers</h3><p>In platforms like GitHub, GitLab, or Bitbucket, you can add reviewers or request a review directly in the PR interface. Notifications will be sent to the assigned reviewers.</p><h3>Best Practices for PR Assignment in Teams</h3><ul><li>Assign at least one reviewer who is familiar with the codebase.</li><li>Add a description that outlines the purpose of the PR and any special instructions.</li></ul><h3>How Git Rebase Works</h3><h3>Differences Between Merge and Rebase</h3><ul><li><strong>Merge</strong>: Combines branches with a new merge commit.</li><li><strong>Rebase</strong>: Applies commits from one branch onto another without a merge commit, keeping the history linear.</li></ul><h3>Advantages and Disadvantages of Rebasing</h3><ul><li><strong>Advantages</strong>: Cleaner, linear commit history.</li><li><strong>Disadvantages</strong>: Can be risky when working in shared branches, as it rewrites history.</li></ul><h3>How to Rebase Without Losing Changes</h3><p>Always rebase local branches against the remote:</p><pre>git fetch origin<br>git rebase origin/main</pre><p>Resolve any conflicts and then push your changes.</p><h3>Methods to Switch and Create Git Branches</h3><h3>Git Checkout Command to Switch Branches</h3><p>Use the git checkout command to switch branches:</p><pre>git checkout &lt;branch_name&gt;</pre><h3>Using Git Switch for Better Workflow</h3><p>git switch is a newer, more intuitive command for switching branches:</p><pre>git switch &lt;branch_name&gt;</pre><h3>Creating New Branches Using Git Commands</h3><p>To create a new branch:</p><pre>git branch &lt;new_branch_name&gt;</pre><p>Or, create and switch to a new branch in one step:</p><pre>git checkout -b &lt;new_branch_name&gt;</pre><h3>Creating a Pull Request (PR)</h3><h3>What is a Pull Request?</h3><p>A pull request (PR) is a request to merge your changes into another branch, typically the main branch. It allows others to review and approve your code before it&#39;s merged.</p><h3>Steps for Creating a PR</h3><ol><li>Push your branch to the remote repository.</li><li>Go to the repository on GitHub, GitLab, or Bitbucket.</li><li>Select “Create Pull Request.”</li><li>Add a meaningful title and description.</li><li>Assign reviewers and submit the PR.</li></ol><h3>Review Process for Merging PRs</h3><p>Reviewers will comment on your PR with feedback, request changes, or approve it. Once all required approvals are obtained, the PR can be merged into the target branch.</p><h3>Best Practices for Working with Git in a Team</h3><h3>Establishing a Git Workflow: GitFlow, GitHub Flow, etc.</h3><p>Popular workflows include:</p><ul><li><strong>GitFlow</strong>: Branching model with develop, feature, and release branches.</li><li><strong>GitHub Flow</strong>: Simpler model focused on main and feature branches.</li><li><strong>Trunk-based development</strong>: Continuous integration with frequent merges into the main branch.</li></ul><h3>Naming Conventions for Branches and Commits</h3><ul><li>Use clear and descriptive branch names (e.g., feature/login-form).</li><li>Write concise commit messages that explain what the commit does.</li></ul><h3>Using Tags for Version Control</h3><p>Tags are useful for marking releases. To create a tag:</p><pre>git tag -a v1.0 -m &quot;Version 1.0 release&quot;<br>git push origin --tags</pre><h3>Using Git Remotes for Collaboration</h3><h3>What is a Git Remote?</h3><p>A remote is a reference to a remote repository. You use remotes to fetch or push code to shared repositories.</p><h3>How to Add and Manage Multiple Remotes</h3><p>To add a new remote:</p><pre>git remote add &lt;name&gt; &lt;url&gt;</pre><p>You can fetch from multiple remotes by using their names.</p><h3>Fetching and Pulling Changes from Multiple Remotes</h3><p>To fetch changes from all remotes:</p><pre>git fetch --all</pre><p>You can also pull changes from a specific remote with:</p><pre>git pull &lt;remote_name&gt; &lt;branch&gt;</pre><h3>Monitoring Changes in Git</h3><h3>Using Git Log to Track Commits</h3><p>The git log command shows the commit history for a repository. You can format it to display details like the author, date, and changes made.</p><h3>Viewing Branch History with Git Commands</h3><p>To view the history of a specific branch:</p><pre>git log &lt;branch_name&gt;</pre><h3>Using Diff Tools to Compare Changes</h3><p>Use git diff to compare changes between branches, commits, or working states. Many GUI tools can also provide visual diffs.</p><h3>Working with Git Stash</h3><h3>Saving Uncommitted Work with Git Stash</h3><p>Git stash allows you to temporarily save your uncommitted changes:</p><pre>git stash</pre><p>This is useful if you need to switch branches but aren’t ready to commit your changes.</p><h3>How to Apply Stashed</h3><p>Changes to Different Branches To apply stashed changes to your current branch:</p><pre>git stash apply</pre><p>You can also specify a particular stash using git stash apply stash@{0}.</p><h3>Cleaning Up Stashed Work to Avoid Clutter</h3><p>Once you’re done with a stash, you can delete it using:</p><pre>git stash drop</pre><p>Or clean all stashes:</p><pre>git stash clear</pre><h3>Avoiding Common Git Mistakes</h3><h3>How to Avoid and Recover from Mistakes in Git</h3><ul><li>Always pull the latest changes before starting new work.</li><li>Commit frequently with descriptive messages.</li></ul><h3>Reverting Commits Safely</h3><p>To undo a commit without losing the changes:</p><pre>git revert &lt;commit_hash&gt;</pre><h3>Resetting vs. Reverting: When to Use Each</h3><ul><li><strong>Reset</strong>: Moves the branch pointer to an earlier commit, altering the commit history.</li><li><strong>Revert</strong>: Creates a new commit that undoes the changes of a previous commit without modifying the history.</li></ul><h4>For getting to know how to make first open-source contribution you can reed this:</h4><p><a href="https://medium.com/@dheerajjha451/what-is-open-source-contribution-5fed69bb4e90">https://medium.com/@dheerajjha451/what-is-open-source-contribution-5fed69bb4e90</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=43bc3e3f2e17" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I Landed My First Freelance Work]]></title>
            <link>https://medium.com/@dheerajjha451/how-i-landed-my-first-freelance-work-7a2d7328f943?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7a2d7328f943</guid>
            <category><![CDATA[freelancers]]></category>
            <category><![CDATA[freelance]]></category>
            <category><![CDATA[freelancing]]></category>
            <category><![CDATA[full-stack]]></category>
            <category><![CDATA[money]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Wed, 31 Jul 2024 11:37:37 GMT</pubDate>
            <atom:updated>2024-07-31T11:48:17.634Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction</h3><p>Starting a freelance career can be both exciting and daunting. For me, it was a journey filled with learning, growth, and a fair share of challenges. I landed my first freelance work with Kioskkarte, a Germany-based startup. Here’s how it all began and the lessons I learned along the way.</p><h3>The 0 to 1 Journey</h3><p>Before landing my first freelance work, I was always interested in building projects. However, in my initial days, I didn’t launch my projects. I would build them and push the code to GitHub. Soon, I realized that I need to launch the projects so I get feedback related to my work users are not interested in cloning projects and running them on their local systems. Additionally, I couldn’t truly understand the quality and scalability of my projects unless they were publicly accessible.</p><h3>Building and Launching Projects</h3><p>I started deploying my projects, making them accessible to a wider audience. Among the various projects I built, a few caught the attention of many users. One such project was the <a href="https://www.designtocode.me/">Design2Code</a> website, which is among the weekly <strong>TOP</strong> <strong>10 </strong>on Peerlist and<strong> TOP 3</strong> on Fazier. It has reached thousands of visitors. The other one is OncoSight. This project helps to win the hackathon, and it also crosses thousands of visitors. It is among the<strong> TOP 1</strong> products of the day and weekly among the <strong>TOP 5 </strong>on Fazier.</p><h3>The Turning Point: Kioskkarte</h3><p>One day, I received an direct email from the client. It was from Kioskkarte, a startup in Germany looking for a developer to help build their platform. They were impressed with the work showcased on my site, which demonstrated my knowledge and passion for web development. They get to know about my email through my <a href="https://www.dheeraj-jha.tech/">portfolio</a> website</p><h3>The Project with Kioskkarte</h3><p>Working with Kioskkarte was an incredible experience. I was responsible for developing their MVP (Minimum Viable Product). This project not only helped me gain practical experience but also taught me the importance of clear communication, meeting deadlines, and adapting to clients’ needs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*oc7YxEaN9KdTxjum6wBvrw.png" /></figure><h3>Lessons Learned</h3><h3>1. Create a Strong Online Presence</h3><p>Your personal website is your digital business card. Make it professional, showcase your best work, and keep it updated.</p><h3>2. Invest in SEO and Content</h3><p>Visibility is key. Invest time in SEO and make sure your portfolio is updated to attract potential clients.</p><h3>3. Be Open to Opportunities</h3><p>You never know where your next project will come from. Be open to inquiries and always respond professionally and promptly.</p><h3>4. Communicate Effectively</h3><p>Clear and regular communication with your clients builds trust and ensures that the project runs smoothly.</p><h3>5. Continuous Learning</h3><p>Freelancing is a journey of continuous learning. Every project brings new challenges and opportunities to grow your skills.</p><h3>Conclusion</h3><p>Landing my first freelance job with Kioskkarte through my personal website was a game-changer. It validated my efforts and set the foundation for my freelancing career. If you’re aspiring to start freelancing, focus on building a strong online presence, invest in personal website, and always be ready to learn and adapt. Your first client could be just a step away!</p><h3><strong>Note:</strong></h3><h4><strong>If you are looking for a freelancer to build your SaaS product or your websites. I am open to work.</strong></h4><p>Here is my portfolio: <a href="https://www.dheeraj-jha.tech/">https://www.dheeraj-jha.tech/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7a2d7328f943" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[OncoSight for accurate and speedy detection of Brain tumor.]]></title>
            <link>https://medium.com/@dheerajjha451/oncosight-for-accurate-and-speedy-detection-of-brain-tumor-34455d5e5a26?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/34455d5e5a26</guid>
            <category><![CDATA[flask]]></category>
            <category><![CDATA[brain-health]]></category>
            <category><![CDATA[web]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Mon, 29 Apr 2024 19:34:33 GMT</pubDate>
            <atom:updated>2024-04-29T19:34:33.745Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction:</h3><p>Our platform is dedicated to <strong>advancing medical image segmentation,</strong> with a special focus on accurately detecting <strong>brain tumors </strong>from <strong>MRI scans</strong>.​</p><p>​We’ve developed this website to assist doctors, streamlining their diagnostic process and <strong>saving valuable time</strong>.​ By inputting medical images into our system, healthcare professionals can receive <strong>predictive insights </strong>into the type of cancer present.​</p><p>​Additionally, we offer <strong>a news and articles </strong>section for updates on diseases and medical advancements. To enhance accessibility, we provide a <strong>video call feature</strong>, facilitating remote consultations between doctors and patients, particularly beneficial for those in <strong>remote areas unable to visit a medical professional in person and a 24/7 chatbot assistant which helps to assist query related to brain tumor and lung cancer.</strong></p><h3>Why OncoSight?</h3><p>We discovered that there are existing models that can predict the type of brain tumor, but no platform allows for the upload of an MRI image and provides results. That’s when we came up with our solution. During the hackathon, we also thought of incorporating a one-on-one video call feature between doctors and patients, adding the latest articles and news related to these diseases, and a chatbot assistant for any queries related to these illnesses.</p><h3><strong>Network Architecture ​</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*6oJ2LcJXz0_8W-uLVhEUdQ.png" /></figure><h3><strong>How our Project works?</strong></h3><p>Initially, the application presents a login screen where existing users can directly log in using their email and password. If you are a new user, you must create an account. After going through the authentication process, you will be directed to the brain tumor screen where you can upload the MRI image. The platform will then predict the type of brain tumor you have, which could be <strong>glioma, pituitary, meningioma, or no tumor </strong>at all. Additionally, the platform provides a brief description of the tumor detected.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QacSJa6yj1RnDyLaXpSU-Q.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*crqi4Zkkb1_x6aTo9u0AKA.png" /></figure><p>Further functionality of Article, VideoCall, and Chat-bot can be seen in the video below:-</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FJD37QwRtwGw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DJD37QwRtwGw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FJD37QwRtwGw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/cc8c34a53fa8d7c2e6d35cf2cdde20ff/href">https://medium.com/media/cc8c34a53fa8d7c2e6d35cf2cdde20ff/href</a></iframe><h3><strong>Technology Used:</strong></h3><p>Flask, Nextjs, Express, nodejs, mongodb, mongoose, Zegocloud, botpress, TailwindCSS.</p><h3><strong>Resources:</strong></h3><p><a href="https://www.kaggle.com/datasets/masoudnickparvar/brain-tumor-mri-dataset">Brain Tumor Dataset</a></p><p><a href="https://www.kaggle.com/code/samarthsoni106/brain-tumor-detection-using-tensorflow">Brain Tumor Detection using Tensorflow</a></p><p><a href="https://github.com/Dheerajjha451/OncoScout">Github Repository</a></p><h3>Note: I am happy to share that we came in under the top 10 teams in the hackathon Hack&amp;Chill.</h3><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=34455d5e5a26" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Docker 0 to 1]]></title>
            <link>https://medium.com/@dheerajjha451/docker-0-to-1-part-1-7647c18d177b?source=rss-59998ae7068e------2</link>
            <guid isPermaLink="false">https://medium.com/p/7647c18d177b</guid>
            <category><![CDATA[containerization]]></category>
            <category><![CDATA[dockerfiles]]></category>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[open-source]]></category>
            <category><![CDATA[webdev]]></category>
            <dc:creator><![CDATA[Dheerajjha]]></dc:creator>
            <pubDate>Sun, 18 Feb 2024 11:55:07 GMT</pubDate>
            <atom:updated>2024-02-23T10:11:23.941Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Wwr184ITevfk2kNm9RJ4pg.jpeg" /></figure><p><strong>Introduction:</strong></p><p>In the dynamic world of web development, Docker has emerged as a game-changer, simplifying the development and deployment processes. From beginners to advanced developers, understanding Docker and its ecosystem is crucial for streamlining workflows. This comprehensive guide will take you on a journey from the basics to advanced Docker concepts, empowering you to harness the full potential of containerization.</p><h3><strong>Why Containers Make Life Easier?</strong></h3><p><strong>Development:</strong></p><p>Imagine this: Setting up your project involves installing databases, running scripts, and navigating system-specific quirks. With Docker, it’s as simple as saying, “Run Docker Compose up” using the Docker CLI (Command Line Interface). Everything your app needs is packed neatly into a container, making sure it behaves consistently everywhere. No more “it works on my machine” headaches.</p><p><strong>Deployment:</strong></p><p>Traditional deployments can be a headache — server provisioning, configuration, copying files, and running commands. Docker, with its Docker Engine and Docker API, makes it a breeze: “Run this container image with these settings” using the CLI. It’s like shipping your app in a magic box that works the same on any server. Simple, right?</p><p><strong>Breaking Down Docker Components:</strong></p><blockquote><strong>Docker CLI (Command Line Interface):</strong></blockquote><ul><li><strong>Usage:</strong> Execute commands like “docker run,” “docker build,” and “docker-compose” to manage containers.</li><li><strong>Key Functions:</strong> Creating, running, and managing containers with simple commands.</li></ul><blockquote><strong>Docker Engine:</strong></blockquote><ul><li><strong>Definition:</strong> Core of Docker, responsible for building, running, and managing containers.</li><li><strong>Role:</strong> Like the chef in your kitchen, executing commands and managing containers.</li></ul><blockquote><strong>Docker Daemon:</strong></blockquote><p><strong>Role:</strong> Watchful guardian running in the background, managing container life-cycles and system integration.</p><blockquote><strong>Docker API:</strong></blockquote><ul><li><strong>Definition:</strong> A set of tools for developers to interact with Docker programmatically.</li><li><strong>Use Case:</strong> Automate Docker workflows, integrate with CI/CD pipelines, and customize interactions.</li></ul><p><strong>Understanding Docker Basics:</strong></p><blockquote><strong>Containers 101:</strong></blockquote><ul><li><strong>Definition:</strong> Lightweight, portable units encapsulating an application and its dependencies.</li><li><strong>Key Advantage:</strong> Consistency across different environments, eliminating the “it works on my machine” dilemma.</li></ul><blockquote><strong>Docker file:</strong></blockquote><ul><li><strong>Definition:</strong> A script that defines the steps to create a Docker image.</li><li><strong>Usage:</strong> Specify dependencies, configure settings, and define the environment for your application.</li></ul><blockquote><strong>Docker Compose:</strong></blockquote><ul><li><strong>Purpose:</strong> Define and manage multi-container applications.</li><li><strong>Usage:</strong> Compose files (YAML) help orchestrate multiple services, simplifying complex setups.</li></ul><p><strong>Development with Docker:</strong></p><blockquote><strong>Volumes:</strong></blockquote><ul><li><strong>Definition:</strong> Mechanism for persisting data beyond the container’s lifecycle.</li><li><strong>Use Case:</strong> Share data between the host and containers or between multiple containers.</li></ul><blockquote><strong>Networking:</strong></blockquote><ul><li><strong>Purpose:</strong> Facilitate communication between containers.</li><li><strong>Key Concept:</strong> Containers can communicate via named networks, ensuring secure and efficient interaction.</li></ul><p><strong>Advanced Docker Concepts:</strong></p><blockquote><strong>Docker Registry:</strong></blockquote><ul><li><strong>Definition:</strong> Repository for storing and distributing Docker images.</li><li><strong>Popular Choices:</strong> Docker Hub, Amazon ECR, Google Container Registry.</li></ul><blockquote><strong>Orchestration with Kubernetes:</strong></blockquote><ul><li><strong>Purpose:</strong> Manage, scale, and automate containerized applications.</li><li><strong>Use Case:</strong> Ideal for large-scale deployments and microservices architectures.</li></ul><blockquote><strong>Monitoring and Logging:</strong></blockquote><ul><li><strong>Tools:</strong> Docker provides APIs for monitoring container health.</li><li><strong>Integration:</strong> Use logging solutions like ELK Stack or Splunk for comprehensive insights.</li></ul><h3><strong>Docker Commands:</strong></h3><blockquote><strong>Docker Version Check:</strong></blockquote><ul><li>Explain how to check the installed Docker version.</li></ul><pre>docker --version</pre><blockquote><strong>Hello-World Container:</strong></blockquote><ul><li>Showcase the classic hello-world container for a quick validation.</li></ul><pre>docker run hello-world</pre><blockquote><strong>List Docker Images:</strong></blockquote><ul><li>Explain how to list locally available Docker images.</li></ul><pre>docker images</pre><blockquote><strong>List All Containers (including stopped ones):</strong></blockquote><pre>docker ps -a</pre><blockquote><strong>Docker Stop and Docker RM:</strong></blockquote><ul><li>These commands are essential for stopping and removing containers. They help manage container life-cycles efficiently.</li><li>These commands stop and remove a specific container, respectively.</li></ul><pre>docker stop container_id_or_name<br>docker rm container_id_or_name</pre><h4><a href="https://docs.docker.com/engine/reference/commandline/docker/">See more</a></h4><p><strong>Conclusion:</strong></p><p>Whether you’re a beginner or an advanced web developer, Docker is a powerful tool that can transform your development and deployment experiences.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7647c18d177b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>