<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Mohammed Taukir Sheikh</title>
    <description>The latest articles on Forem by Mohammed Taukir Sheikh (@taukirsheikh).</description>
    <link>https://forem.com/taukirsheikh</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1061165%2Fdc15f26c-8441-4cb6-9366-7a6882026a7e.png</url>
      <title>Forem: Mohammed Taukir Sheikh</title>
      <link>https://forem.com/taukirsheikh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/taukirsheikh"/>
    <language>en</language>
    <item>
      <title>How to Build Your Own Local AI Agent: Setting Up OpenClaw with Ollama and Slack on Ubuntu</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Thu, 02 Apr 2026 16:22:27 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/how-to-build-your-own-local-ai-agent-setting-up-openclaw-with-ollama-and-slack-on-ubuntu-17bc</link>
      <guid>https://forem.com/taukirsheikh/how-to-build-your-own-local-ai-agent-setting-up-openclaw-with-ollama-and-slack-on-ubuntu-17bc</guid>
      <description>&lt;p&gt;Imagine having a personal assistant that lives on your computer, respects your privacy, costs $0 in subscription fees, and chats with you directly through Slack.&lt;/p&gt;

&lt;h2&gt;
  
  
  This guide will show you how to set up OpenClaw (an open-source AI agent), Ollama (to run the AI brain locally), and Slack (the interface) on an Ubuntu system. Even if you aren't a Linux expert, you can follow these steps to get your agent running.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;A computer running Ubuntu (20.04 or newer).&lt;/li&gt;
&lt;li&gt;A Slack workspace where you have permission to add apps.&lt;/li&gt;
&lt;li&gt;Basic comfort with the Terminal (Ctrl+Alt+T).&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Step 1: Install the "Brain" (Ollama)
&lt;/h2&gt;

&lt;p&gt;Ollama allows your computer to run powerful AI models (like Llama 3 or Qwen) locally so your data never leaves your machine.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run the Installer: Open your terminal and paste this command:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;curl -fsSL &lt;a href="https://ollama.com" rel="noopener noreferrer"&gt;https://ollama.com&lt;/a&gt; | sh&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download a Model: We’ll use qwen2.5-coder, which is excellent at following instructions and using tools.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;ollama pull qwen2.5-coder:7b&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 2: Install the "Agent" (OpenClaw)
&lt;/h2&gt;

&lt;p&gt;OpenClaw is the "body" of your assistant. It takes your Slack messages, asks the AI brain what to do, and performs tasks like searching files or the web.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Install Dependencies: OpenClaw needs Node.js. The easiest way is the official script:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;curl -fsSL &lt;a href="https://openclaw.ai" rel="noopener noreferrer"&gt;https://openclaw.ai&lt;/a&gt; | bash&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Run Onboarding: This command sets up the background services.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;openclaw onboard --install-daemon&lt;/p&gt;

&lt;p&gt;Follow the prompts: Select Manual and Local when asked.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Start the Gateway:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;openclaw gateway start&lt;/p&gt;




&lt;h2&gt;
  
  
  Step 3: Create the "Interface" (Slack App)
&lt;/h2&gt;

&lt;p&gt;To talk to your agent, you need to create a "bot" in Slack.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create App: Go to &lt;a href="https://api.slack.com/apps" rel="noopener noreferrer"&gt;Slack API Dashboard&lt;/a&gt; → Create New App → From Scratch. Name it "MyAI" and pick your workspace.&lt;/li&gt;
&lt;li&gt;Enable Socket Mode: This allows the bot to work without complex networking.&lt;/li&gt;
&lt;li&gt;In the left sidebar, click Socket Mode → Toggle Enable.

&lt;ul&gt;
&lt;li&gt;Give the token a name (e.g., "OpenClawToken") and click Generate.&lt;/li&gt;
&lt;li&gt;Copy the token (starts with xapp-).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Permissions (Scopes):&lt;/li&gt;
&lt;li&gt;Go to OAuth &amp;amp; Permissions.

&lt;ul&gt;
&lt;li&gt;Scroll to Bot Token Scopes and add: app_mentions:read, chat:write, im:history, and im:read.&lt;/li&gt;
&lt;li&gt;Scroll up and click Install to Workspace.&lt;/li&gt;
&lt;li&gt;Copy the Bot User OAuth Token (starts with xoxb-).&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Events:&lt;/li&gt;
&lt;li&gt;Go to Event Subscriptions → Toggle On.

&lt;ul&gt;
&lt;li&gt;Under "Subscribe to bot events," add app_mention and message.im. Click Save Changes.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Step 4: Connecting Everything
&lt;/h2&gt;

&lt;p&gt;Now, tell OpenClaw how to talk to Slack and Ollama.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Configure Tokens: Replace the placeholders below with your actual tokens from Step 3:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;openclaw config set channels.slack.enabled true&lt;br&gt;
   openclaw config set channels.slack.appToken "YOUR_XAPP_TOKEN"&lt;br&gt;
   openclaw config set channels.slack.botToken "YOUR_XOXB_TOKEN"&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Connect Ollama: Tell OpenClaw to use your local AI model.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;openclaw config set provider.type "ollama"&lt;br&gt;
   openclaw config set provider.model "qwen2.5-coder:7b"&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Restart &amp;amp; Pair:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;openclaw gateway restart&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Final Handshake:&lt;/li&gt;
&lt;li&gt;Open Slack and find your new bot under "Apps."

&lt;ul&gt;
&lt;li&gt;Send it a message like "Hello."&lt;/li&gt;
&lt;li&gt;The bot will reply with a Pairing Code.&lt;/li&gt;
&lt;li&gt;Go back to your Ubuntu terminal and type:
openclaw pairing approve slack &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  Success!
&lt;/h2&gt;

&lt;p&gt;Your local AI agent is now live. You can ask it to write code, summarize text, or (once you install more "skills" from the OpenClaw dashboard) manage your calendar and files.&lt;/p&gt;

</description>
      <category>agents</category>
      <category>ai</category>
      <category>linux</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Fixing Slow MongoDB Queries on Array Fields Using `$elemMatch`</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Fri, 13 Mar 2026 09:05:57 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/fixing-slow-mongodb-queries-on-array-fields-using-elemmatch-4e59</link>
      <guid>https://forem.com/taukirsheikh/fixing-slow-mongodb-queries-on-array-fields-using-elemmatch-4e59</guid>
      <description>&lt;p&gt;When working with MongoDB, queries on &lt;strong&gt;arrays of objects&lt;/strong&gt; can sometimes become slow even if you have indexes.&lt;/p&gt;

&lt;p&gt;In this article, we’ll explore &lt;strong&gt;why that happens&lt;/strong&gt; and how using &lt;strong&gt;&lt;code&gt;$elemMatch&lt;/code&gt;&lt;/strong&gt; can make your queries &lt;strong&gt;fast and efficient&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  1. The Data Structure
&lt;/h2&gt;

&lt;p&gt;Suppose you have a &lt;code&gt;users&lt;/code&gt; collection with documents like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Alice&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cart&lt;/code&gt; is an &lt;strong&gt;array of objects&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Each object contains:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;product&lt;/code&gt; → name of the item&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;quantity&lt;/code&gt; → how many of that item&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;/ul&gt;




&lt;h2&gt;
  
  
  2. The Common Query
&lt;/h2&gt;

&lt;p&gt;You want to find users who have &lt;strong&gt;2 Apples&lt;/strong&gt; in their cart:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.quantity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At first glance, this seems correct.&lt;/p&gt;

&lt;p&gt;But MongoDB interprets it as:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find users where &lt;strong&gt;some array element has &lt;code&gt;product = Apple&lt;/code&gt;&lt;/strong&gt;&lt;br&gt;
AND &lt;strong&gt;some array element has &lt;code&gt;quantity = 2&lt;/code&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;⚠️ Notice: MongoDB does &lt;strong&gt;not guarantee these two conditions are in the same cart item&lt;/strong&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. Why This Can Be Slow
&lt;/h2&gt;

&lt;p&gt;Consider a user document like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Bob&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="nx"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Banana&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;cart.product = Apple&lt;/code&gt; → matches first element ✅&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cart.quantity = 2&lt;/code&gt; → matches second element ✅&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;MongoDB &lt;strong&gt;thinks this document could match&lt;/strong&gt;.&lt;br&gt;
It must &lt;strong&gt;fetch and check the full document&lt;/strong&gt;, even though there’s &lt;strong&gt;no cart item with Apple and quantity 2 together&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This unnecessary document fetch makes queries slow, especially on &lt;strong&gt;large collections&lt;/strong&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  4. The &lt;code&gt;$elemMatch&lt;/code&gt; Solution
&lt;/h2&gt;

&lt;p&gt;To fix this, use &lt;strong&gt;&lt;code&gt;$elemMatch&lt;/code&gt;&lt;/strong&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;$elemMatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now MongoDB understands:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Find a &lt;strong&gt;single element in the cart array&lt;/strong&gt; where both conditions match.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;This allows MongoDB to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;strong&gt;index efficiently&lt;/strong&gt; (if you have one)&lt;/li&gt;
&lt;li&gt;Avoid scanning unnecessary documents&lt;/li&gt;
&lt;li&gt;Dramatically improve performance&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  5. Indexing for Speed
&lt;/h2&gt;

&lt;p&gt;If your collection is large, create a &lt;strong&gt;compound index&lt;/strong&gt; on the array fields:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createIndex&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.quantity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With &lt;code&gt;$elemMatch&lt;/code&gt;, MongoDB can directly use this index for the query.&lt;/p&gt;




&lt;h2&gt;
  
  
  6. Visual Comparison
&lt;/h2&gt;

&lt;h3&gt;
  
  
  ❌ Without &lt;code&gt;$elemMatch&lt;/code&gt;:
&lt;/h3&gt;

&lt;p&gt;MongoDB workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Find any element with product = "Apple"
2. Scan each document to check if quantity = 2 exists
3. Return documents
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Can scan &lt;strong&gt;thousands of documents&lt;/strong&gt; unnecessarily&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  ✅ With &lt;code&gt;$elemMatch&lt;/code&gt;:
&lt;/h3&gt;

&lt;p&gt;MongoDB workflow:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. Find elements with product = "Apple" AND quantity = 2 in the same array item
2. Return matching documents immediately
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Only fetches the &lt;strong&gt;relevant documents&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;Much faster&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  7. Key Takeaways
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;When querying &lt;strong&gt;multiple conditions on an array of objects&lt;/strong&gt;, always use &lt;code&gt;$elemMatch&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;$elemMatch&lt;/code&gt; ensures &lt;strong&gt;all conditions match the same array element&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;Combine &lt;code&gt;$elemMatch&lt;/code&gt; with &lt;strong&gt;indexes&lt;/strong&gt; for maximum performance.&lt;/li&gt;
&lt;li&gt;This simple change can make queries &lt;strong&gt;up to 100× faster&lt;/strong&gt;.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;✅ &lt;strong&gt;Example Summary&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Slow query (can match across different elements)&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.product&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;cart.quantity&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Fast query (matches same element)&lt;/span&gt;
&lt;span class="nx"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;users&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;find&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;cart&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;$elemMatch&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;product&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Apple&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;quantity&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>database</category>
      <category>mongodb</category>
      <category>performance</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Singleton Pattern issue in playwright browser</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Sun, 23 Nov 2025 06:20:31 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/singleton-pattern-issue-in-playwright-brwoser-g9b</link>
      <guid>https://forem.com/taukirsheikh/singleton-pattern-issue-in-playwright-brwoser-g9b</guid>
      <description>&lt;p&gt;Explaining why the singleton pattern retains the previous value:&lt;/p&gt;

&lt;h2&gt;
  
  
  Why singleton pattern using previous value
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The singleton pattern structure:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ONE instance created when module loads&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;playwrightManager&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;PlaywrightBrowserManager&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// This instance has properties:&lt;/span&gt;
&lt;span class="c1"&gt;// - this.browser = null (initially)&lt;/span&gt;
&lt;span class="c1"&gt;// - this.context = null (initially)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The problem flow:
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Scenario 1: First request&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Request A comes in&lt;/span&gt;
&lt;span class="nx"&gt;playwrightManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launchBrowser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BrowserInstance1 &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;✅&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;Browser&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt; &lt;span class="nx"&gt;opens&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Scenario 2: Second request (the problem)&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Request B comes in 2 seconds later&lt;/span&gt;
&lt;span class="nx"&gt;playwrightManager&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launchBrowser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;Checks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Does&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="nx"&gt;exist&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;YES &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;BrowserInstance1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;Checks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Is&lt;/span&gt; &lt;span class="nx"&gt;it&lt;/span&gt; &lt;span class="nx"&gt;connected&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;YES &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;still&lt;/span&gt; &lt;span class="nx"&gt;running&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;Checks&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Does&lt;/span&gt; &lt;span class="nx"&gt;headless&lt;/span&gt; &lt;span class="nx"&gt;match&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="nc"&gt;NO &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="nx"&gt;vs&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;BUT&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;BrowserInstance1&lt;/span&gt; &lt;span class="nx"&gt;was&lt;/span&gt; &lt;span class="nx"&gt;ALREADY&lt;/span&gt; &lt;span class="nx"&gt;launched&lt;/span&gt; &lt;span class="kd"&gt;with&lt;/span&gt; &lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;BrowserInstance1&lt;/span&gt; &lt;span class="nx"&gt;CANNOT&lt;/span&gt; &lt;span class="nx"&gt;change&lt;/span&gt; &lt;span class="nx"&gt;its&lt;/span&gt; &lt;span class="nx"&gt;headless&lt;/span&gt; &lt;span class="nx"&gt;setting&lt;/span&gt; &lt;span class="nx"&gt;after&lt;/span&gt; &lt;span class="nx"&gt;launch&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;Returns&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;existing&lt;/span&gt; &lt;span class="nc"&gt;BrowserInstance1 &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;still&lt;/span&gt; &lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;❌&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why you can't change headless after launch:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// When you launch a browser:&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;chromium&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launch&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="c1"&gt;// The browser is NOW running with headless=false&lt;/span&gt;
&lt;span class="c1"&gt;// You CANNOT do: browser.setHeadless(true) ❌ (doesn't exist)&lt;/span&gt;

&lt;span class="c1"&gt;// The headless setting is baked into the browser process&lt;/span&gt;
&lt;span class="c1"&gt;// Once launched, it's fixed until you close and relaunch&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Visual representation:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;┌─────────────────────────────────────────────┐
│  Singleton Instance (ONE for entire app)   │
│  ┌───────────────────────────────────────┐ │
│  │ this.browser = BrowserInstance1      │ │ ← Shared by ALL requests
│  │   - headless: false (fixed forever)  │ │
│  │   - launched at: 10:00:00            │ │
│  │   - still connected: YES             │ │
│  └───────────────────────────────────────┘ │
│                                            │
│  Request A (10:00:00):                    │
│    launchBrowser({headless: false})        │
│    → Creates BrowserInstance1 ✅          │
│                                            │
│  Request B (10:00:02):                    │
│    launchBrowser({headless: true})        │
│    → Sees BrowserInstance1 exists         │
│    → Tries to reuse it                    │
│    → But it's still headless: false ❌    │
└─────────────────────────────────────────────┘
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  The code that caused the issue:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// In the old singleton code:&lt;/span&gt;
&lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;isConnected&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Browser exists and is running&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;currentHeadless&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Settings match - reuse browser ✅&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;context&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;context&lt;/span&gt; &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Settings DON'T match, but browser is still connected&lt;/span&gt;
    &lt;span class="c1"&gt;// What happens? It might still return the old browser!&lt;/span&gt;
    &lt;span class="c1"&gt;// OR it creates a new one but doesn't close the old one properly&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Why separate instances fix it:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Request A&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;managerA&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;playwrightManager&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;  &lt;span class="c1"&gt;// NEW instance&lt;/span&gt;
&lt;span class="nx"&gt;managerA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launchBrowser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;managerA&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BrowserInstance1 &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;✅&lt;/span&gt;

&lt;span class="c1"&gt;// Request B (simultaneously)&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;managerB&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;playwrightManager&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;  &lt;span class="c1"&gt;// DIFFERENT instance&lt;/span&gt;
&lt;span class="nx"&gt;managerB&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;launchBrowser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;managerB&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;browser&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;BrowserInstance2 &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;headless&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;✅&lt;/span&gt;
  &lt;span class="err"&gt;→&lt;/span&gt; &lt;span class="nx"&gt;No&lt;/span&gt; &lt;span class="nx"&gt;conflict&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="nx"&gt;Each&lt;/span&gt; &lt;span class="nx"&gt;has&lt;/span&gt; &lt;span class="nx"&gt;its&lt;/span&gt; &lt;span class="nx"&gt;own&lt;/span&gt; &lt;span class="nx"&gt;browser&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Key points:
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Browser headless setting is immutable after launch — you can't change it.&lt;/li&gt;
&lt;li&gt;Singleton shares one browser instance — all requests use the same &lt;code&gt;this.browser&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Reuse logic — if a browser exists and is connected, it may be reused even with different settings.&lt;/li&gt;
&lt;li&gt;Timing — if Request A's browser is still running when Request B starts, Request B might get the old browser.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  The fix:
&lt;/h3&gt;

&lt;p&gt;With separate instances:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Each request gets its own &lt;code&gt;PlaywrightBrowserManager&lt;/code&gt; instance&lt;/li&gt;
&lt;li&gt;Each instance has its own &lt;code&gt;this.browser&lt;/code&gt; property&lt;/li&gt;
&lt;li&gt;No sharing = no conflicts&lt;/li&gt;
&lt;li&gt;Each request controls its own browser lifecycle&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That's why separate instances solve the problem — each request gets a fresh browser manager with its own browser instance, so settings aren't shared or reused incorrectly.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>testing</category>
      <category>architecture</category>
      <category>node</category>
    </item>
    <item>
      <title>How web works</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Tue, 02 Sep 2025 10:07:03 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/how-web-works-2lpb</link>
      <guid>https://forem.com/taukirsheikh/how-web-works-2lpb</guid>
      <description>&lt;p&gt;The web—short for the &lt;strong&gt;World Wide Web&lt;/strong&gt;—is a system of interconnected documents and resources, linked by hyperlinks and accessed via the internet. Understanding how the web works involves several key components and processes. Here's a simplified breakdown:&lt;/p&gt;




&lt;h3&gt;
  
  
  1. &lt;strong&gt;Key Components of the Web&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Internet&lt;/strong&gt;: The global network of computers that connects devices worldwide.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Browsers&lt;/strong&gt;: Software like Chrome, Firefox, or Safari that users use to access web content.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Servers&lt;/strong&gt;: Computers that store and serve web pages (e.g., websites).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Web Pages&lt;/strong&gt;: Documents written in HTML (HyperText Markup Language), often enhanced with CSS and JavaScript.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;URLs (Uniform Resource Locators)&lt;/strong&gt;: Addresses used to identify resources on the web (e.g., &lt;code&gt;https://www.example.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTTP/HTTPS&lt;/strong&gt;: Protocols used to transfer data between browsers and servers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. &lt;strong&gt;How It Works: Step-by-Step&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Let’s say you type &lt;code&gt;https://www.google.com&lt;/code&gt; into your browser:&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 1: &lt;strong&gt;Enter URL&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You type a web address (URL) into your browser.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 2: &lt;strong&gt;DNS Lookup&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The browser needs to find the server's IP address (like &lt;code&gt;142.250.180.78&lt;/code&gt;) from the domain name (&lt;code&gt;www.google.com&lt;/code&gt;).&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It queries a &lt;strong&gt;DNS (Domain Name System)&lt;/strong&gt; server, which acts like a phonebook for the internet.&lt;/li&gt;
&lt;li&gt;DNS returns the corresponding IP address.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 3: &lt;strong&gt;HTTP/HTTPS Request&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Your browser sends an &lt;strong&gt;HTTP (HyperText Transfer Protocol)&lt;/strong&gt; or &lt;strong&gt;HTTPS (secure version)&lt;/strong&gt; request to the server at that IP address.&lt;/p&gt;

&lt;p&gt;Example request:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;GET / HTTP/1.1
Host: www.google.com
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Step 4: &lt;strong&gt;Server Processes Request&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The web server receives the request, processes it (e.g., retrieves the requested web page), and sends back a response.&lt;/p&gt;

&lt;h4&gt;
  
  
  Step 5: &lt;strong&gt;Server Sends Response&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;The server sends back an &lt;strong&gt;HTTP response&lt;/strong&gt;, which includes:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Status code (e.g., &lt;code&gt;200 OK&lt;/code&gt; means success)&lt;/li&gt;
&lt;li&gt;The web page content (HTML, CSS, JavaScript, images, etc.)&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 6: &lt;strong&gt;Browser Renders the Page&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;Your browser receives the HTML, CSS, and JavaScript and &lt;strong&gt;renders&lt;/strong&gt; it into a visual webpage.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;It reads the HTML to build the structure.&lt;/li&gt;
&lt;li&gt;Applies CSS for styling.&lt;/li&gt;
&lt;li&gt;Executes JavaScript for interactivity.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Step 7: &lt;strong&gt;Page Loads and Becomes Interactive&lt;/strong&gt;
&lt;/h4&gt;

&lt;p&gt;You now see the webpage and can interact with it (click links, submit forms, etc.).&lt;/p&gt;




&lt;h3&gt;
  
  
  3. &lt;strong&gt;Additional Concepts&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Hyperlinks&lt;/strong&gt;: Clicking a link triggers the same process for a new page.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client-Server Model&lt;/strong&gt;: Your browser (client) requests data; the server responds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Caching&lt;/strong&gt;: Browsers and servers often store copies of pages to load them faster next time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Security (HTTPS)&lt;/strong&gt;: Uses encryption (via SSL/TLS) to protect data in transit.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. &lt;strong&gt;Example Diagram (Simplified)&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;You → Browser → DNS → Server → HTTP Response → Browser Renders → Web Page
       ↑           ↑         ↑
     URL        Finds IP   Sends Data
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h3&gt;
  
  
  Summary
&lt;/h3&gt;

&lt;p&gt;The web works through a &lt;strong&gt;client-server model&lt;/strong&gt; using &lt;strong&gt;HTTP(S)&lt;/strong&gt; over the &lt;strong&gt;internet&lt;/strong&gt;, where:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;You request a webpage via a URL.&lt;/li&gt;
&lt;li&gt;DNS finds the server's IP address.&lt;/li&gt;
&lt;li&gt;Your browser asks the server for the page.&lt;/li&gt;
&lt;li&gt;The server sends back the content.&lt;/li&gt;
&lt;li&gt;Your browser displays it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s a powerful, decentralized system that allows billions of people to share and access information globally.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>🛠️ Fix Broken NPM Packages in 5 Minutes: A Lifesaver Guide for Modern Developers</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Sat, 23 Aug 2025 16:33:10 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/fix-broken-npm-packages-in-5-minutes-a-lifesaver-guide-for-modern-developers-8gc</link>
      <guid>https://forem.com/taukirsheikh/fix-broken-npm-packages-in-5-minutes-a-lifesaver-guide-for-modern-developers-8gc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Tired of waiting for a critical bug fix in a third-party library?&lt;/strong&gt; What if you could fix it yourself—&lt;em&gt;today&lt;/em&gt;—and ensure the fix stays even after &lt;code&gt;npm install&lt;/code&gt;? Meet &lt;code&gt;patch-package&lt;/code&gt;, your secret weapon for resilient, maintainable projects.&lt;/p&gt;

&lt;p&gt;In this guide, you’ll learn how to patch an npm dependency in minutes, save the fix permanently, and share it seamlessly with your team. No more forks, no more deadlocks.&lt;/p&gt;




&lt;h4&gt;
  
  
  🔍 Why Patch a Package?
&lt;/h4&gt;

&lt;p&gt;Third-party libraries are essential, but bugs happen. Opening a PR is the right long-term move—but what if you’re blocked &lt;em&gt;now&lt;/em&gt;?&lt;/p&gt;

&lt;p&gt;That’s where &lt;code&gt;patch-package&lt;/code&gt; shines. It lets you:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Fix bugs directly in &lt;code&gt;node_modules&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Generate a patch file&lt;/li&gt;
&lt;li&gt;Automatically reapply the fix on every install &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It’s like a band-aid for your &lt;code&gt;node_modules&lt;/code&gt;—but one that sticks .&lt;/p&gt;




&lt;h4&gt;
  
  
  🧰 Step 1: Install &lt;code&gt;patch-package&lt;/code&gt;
&lt;/h4&gt;

&lt;p&gt;Add it to your project:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;patch-package &lt;span class="nt"&gt;--save-dev&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then, update your &lt;code&gt;package.json&lt;/code&gt; scripts:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="nl"&gt;"scripts"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="w"&gt;
  &lt;/span&gt;&lt;span class="nl"&gt;"postinstall"&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="s2"&gt;"patch-package"&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures patches are applied automatically after every dependency install .&lt;/p&gt;




&lt;h4&gt;
  
  
  ✏️ Step 2: Make Your Fix
&lt;/h4&gt;

&lt;p&gt;Let’s say &lt;code&gt;buggy-lib&lt;/code&gt; has a function returning incorrect results.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Navigate to &lt;code&gt;node_modules/buggy-lib/dist/index.js&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Find the broken code:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;calculateTotal&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// 🚨 Should be a + b!&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Fix it:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Yes, edit it &lt;em&gt;directly&lt;/em&gt; in &lt;code&gt;node_modules&lt;/code&gt;. It feels wrong—until it works.&lt;/p&gt;




&lt;h4&gt;
  
  
  📦 Step 3: Create the Patch
&lt;/h4&gt;

&lt;p&gt;Run:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npx patch-package buggy-lib
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This generates a patch file:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;patches/buggy-lib+2.1.0.patch
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The file contains a diff showing exactly what changed—perfect for code review .&lt;/p&gt;




&lt;h4&gt;
  
  
  💾 Step 4: Commit &amp;amp; Share
&lt;/h4&gt;

&lt;p&gt;Add the patch to Git:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;git add patches/buggy-lib+2.1.0.patch
git commit &lt;span class="nt"&gt;-m&lt;/span&gt; &lt;span class="s2"&gt;"fix: patch buggy-lib to correct calculation"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, every teammate and your CI/CD pipeline gets the fix automatically. No extra steps needed .&lt;/p&gt;




&lt;h4&gt;
  
  
  🔄 What Happens on Update?
&lt;/h4&gt;

&lt;p&gt;If &lt;code&gt;buggy-lib&lt;/code&gt; releases &lt;code&gt;v2.2.0&lt;/code&gt;, your patch might fail to apply. You’ll see a warning.&lt;/p&gt;

&lt;p&gt;Just:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Re-apply your fix in the updated version&lt;/li&gt;
&lt;li&gt;Re-run &lt;code&gt;npx patch-package buggy-lib&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Commit the updated patch&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;It’s a small price for immediate progress.&lt;/p&gt;




&lt;h4&gt;
  
  
  ✅ Pro Tips
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Use clear titles&lt;/strong&gt; that spark curiosity and promise value .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Break content into digestible sections&lt;/strong&gt; with headings .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Include real-world examples&lt;/strong&gt; to make concepts relatable .&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Always add a cover image&lt;/strong&gt;—it boosts engagement .&lt;/li&gt;
&lt;li&gt;Document &lt;em&gt;why&lt;/em&gt; you patched the library in your commit message or README.&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  🚀 Final Thoughts
&lt;/h4&gt;

&lt;p&gt;&lt;code&gt;patch-package&lt;/code&gt; isn’t a replacement for contributing upstream. Always open that PR! But while you wait, &lt;code&gt;patch-package&lt;/code&gt; keeps your project moving.&lt;/p&gt;

&lt;p&gt;It’s especially useful in React Native and other ecosystems where dependency issues can be frequent .&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Have you used &lt;code&gt;patch-package&lt;/code&gt; to escape a dependency deadlock? Share your story below! 👇&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;If you found this helpful, hit the 🎉 and share it with someone stuck on a &lt;code&gt;node_modules&lt;/code&gt; bug.&lt;/em&gt;&lt;/p&gt;

&lt;h1&gt;
  
  
  npm #webdev #javascript #productivity #devtips #tutorial
&lt;/h1&gt;

</description>
      <category>webdev</category>
      <category>npm</category>
      <category>node</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understanding Children Props in React</title>
      <dc:creator>Mohammed Taukir Sheikh</dc:creator>
      <pubDate>Sat, 08 Apr 2023 05:35:06 +0000</pubDate>
      <link>https://forem.com/taukirsheikh/understanding-children-props-in-react-1g28</link>
      <guid>https://forem.com/taukirsheikh/understanding-children-props-in-react-1g28</guid>
      <description>&lt;p&gt;If you've been working with React, you may have heard the term &lt;code&gt;"children props"&lt;/code&gt; thrown around. But what exactly are children props, and how do they work?&lt;/p&gt;

&lt;p&gt;In short, &lt;strong&gt;children props&lt;/strong&gt; are a way to pass components or elements as children to another component. This allows you to create more flexible and reusable components in your application.&lt;/p&gt;

&lt;p&gt;To understand how children props work, let's consider a real-world example. Imagine you have a parent component called &lt;code&gt;Card&lt;/code&gt;, which displays a box with some content inside. The Card component has a few props, such as &lt;code&gt;title&lt;/code&gt;, &lt;code&gt;subtitle&lt;/code&gt;, and &lt;code&gt;body&lt;/code&gt;, which allow you to customize the content displayed inside the box.&lt;/p&gt;

&lt;p&gt;Now, let's say you want to add a &lt;code&gt;button&lt;/code&gt; to the Card component, but you want to allow the user to customize the button's text and functionality. This is where &lt;code&gt;children props&lt;/code&gt; come in.&lt;/p&gt;

&lt;p&gt;Instead of adding a button prop to the Card component, you can pass the &lt;code&gt;button element&lt;/code&gt; as a &lt;code&gt;child component&lt;/code&gt; to the Card component. Here's how you can do it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;children&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;card&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;subtitle&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Card&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;My Card&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;subtitle&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Subtitle&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;body&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is the body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Button clicked!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Click&lt;/span&gt; &lt;span class="nx"&gt;me&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Card&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, I've added a children prop to the Card component, which allows us to pass any child component to the Card component. In this case, we're passing a button element with an &lt;code&gt;onClick&lt;/code&gt; handler that logs a message to the console.&lt;/p&gt;

&lt;p&gt;By using children props, we've created a more flexible and reusable Card component that can be customized with any child component. This makes our code more modular and easier to maintain.&lt;/p&gt;

&lt;p&gt;Lets see some more examples&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Greeting&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Hello&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;!&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Greeting&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;world&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Greeting&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;In this example, we have a "&lt;code&gt;Greeting&lt;/code&gt;" component that takes in a "&lt;code&gt;children&lt;/code&gt;" prop. The "&lt;code&gt;children&lt;/code&gt;" prop is used to pass in the name of the person being greeted.&lt;/p&gt;

&lt;p&gt;In the "&lt;code&gt;Greeting&lt;/code&gt;" function, we render a &lt;code&gt;p&lt;/code&gt;element that says "&lt;code&gt;Hello&lt;/code&gt;, " followed by the "children" passed in as props, followed by an exclamation point.&lt;/p&gt;

&lt;p&gt;In the "&lt;code&gt;App&lt;/code&gt;" function, we render the "&lt;code&gt;Greeting&lt;/code&gt;" component and pass in the string "&lt;code&gt;world&lt;/code&gt;" as children. This results in the message "Hello, world!" being rendered on the screen.&lt;/p&gt;

&lt;p&gt;This is a simple example, but it shows how the &lt;code&gt;children prop&lt;/code&gt;&lt;br&gt;
can be used to pass content to a component and render it within the component. The possibilities for what can be passed in as children are endless, allowing for great flexibility in creating reusable components.&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Card&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;card&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;card-header&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;card-body&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Card&lt;/span&gt; &lt;span class="nx"&gt;title&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;My Card&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;This&lt;/span&gt; &lt;span class="nx"&gt;is&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;my&lt;/span&gt; &lt;span class="nx"&gt;card&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;p&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;It&lt;/span&gt; &lt;span class="nx"&gt;can&lt;/span&gt; &lt;span class="nx"&gt;contain&lt;/span&gt; &lt;span class="nx"&gt;any&lt;/span&gt; &lt;span class="nx"&gt;type&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;content&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;including&lt;/span&gt; &lt;span class="nx"&gt;images&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;lists&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;more&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/p&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/Card&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;In this example, we have a &lt;code&gt;"Card"&lt;/code&gt; component that takes in a &lt;code&gt;"title"&lt;/code&gt; prop and a &lt;code&gt;"children"&lt;/code&gt; prop. The &lt;code&gt;"title"&lt;/code&gt; prop is used to specify the title of the card, and the &lt;code&gt;"children" prop&lt;/code&gt; is used to pass in the content of the card.&lt;/p&gt;

&lt;p&gt;Lets see one more example&lt;br&gt;
&lt;/p&gt;

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

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;List&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ul&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;list&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;map&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;child&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;li&lt;/span&gt; &lt;span class="nx"&gt;key&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;child&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;child&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/li&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;))}&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/ul&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ListItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;App&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;App&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ListItem&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Item 1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ListItem&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Item 2&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ListItem&lt;/span&gt; &lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="nx"&gt;text&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Item 3&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/List&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;In this example, we have a &lt;code&gt;"List"&lt;/code&gt; component that takes in a "children" prop. The "children" prop is an array of &lt;code&gt;"ListItem"&lt;/code&gt; components, each with its own &lt;code&gt;ID and text&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;"List"&lt;/code&gt; function, we render an unordered list and map over the "children" prop to render each &lt;code&gt;"ListItem"&lt;/code&gt;component as a list item within the list.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;"ListItem"&lt;/code&gt; function, we render a span element with the ID and text passed in as props.&lt;/p&gt;

&lt;p&gt;In the &lt;code&gt;"App"&lt;/code&gt; function, we render the &lt;code&gt;"List"&lt;/code&gt; component and pass in an array of "ListItem" components as children. Each &lt;code&gt;"ListItem"&lt;/code&gt;has its own &lt;code&gt;ID and text&lt;/code&gt;, which are rendered within the &lt;code&gt;"List"&lt;/code&gt; using the &lt;code&gt;"children" prop&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;This allows us to easily create lists of items in our app and customize the content of each item using the &lt;code&gt;"children" prop&lt;/code&gt;. We can pass in any number of "&lt;code&gt;ListItem"&lt;/code&gt; components as children, each with its own content and styling.&lt;/p&gt;

</description>
      <category>react</category>
      <category>props</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
