<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Elizabeth Sobiya</title>
    <description>The latest articles on DEV Community by Elizabeth Sobiya (@elizabethsobiya).</description>
    <link>https://dev.to/elizabethsobiya</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%2F1034958%2F03a485ee-f5ee-4f65-94ba-87b797049201.jpeg</url>
      <title>DEV Community: Elizabeth Sobiya</title>
      <link>https://dev.to/elizabethsobiya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/elizabethsobiya"/>
    <language>en</language>
    <item>
      <title>I Paused My Open Source Project. It Wasn’t Laziness. It Was Imposter Syndrome.</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Sun, 05 Apr 2026 07:24:10 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/i-paused-my-open-source-project-it-wasnt-laziness-it-was-imposter-syndrome-gei</link>
      <guid>https://dev.to/elizabethsobiya/i-paused-my-open-source-project-it-wasnt-laziness-it-was-imposter-syndrome-gei</guid>
      <description>&lt;p&gt;I didn’t stop building because I ran out of ideas.&lt;br&gt;
I didn’t stop because I was busy.&lt;br&gt;
I stopped because, somewhere along the way, I started doubting myself.&lt;/p&gt;

&lt;p&gt;And I didn’t even realize it.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Silent Pause
&lt;/h2&gt;

&lt;p&gt;I was working on my open source project with full energy in the beginning. Ideas were flowing. Architecture decisions felt exciting. Every small feature felt like progress.&lt;/p&gt;

&lt;p&gt;Then slowly, something changed.&lt;/p&gt;

&lt;p&gt;I started questioning everything.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;“Is this architecture even correct?”&lt;/li&gt;
&lt;li&gt;“What if I’m building this the wrong way?”&lt;/li&gt;
&lt;li&gt;“What if someone more experienced looks at this and laughs?”&lt;/li&gt;
&lt;li&gt;“Should I refactor everything before moving forward?”&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Instead of building, I started thinking.&lt;/p&gt;

&lt;p&gt;Instead of shipping, I started overanalyzing.&lt;/p&gt;

&lt;p&gt;And eventually… I stopped.&lt;/p&gt;

&lt;p&gt;Not officially. Not consciously. But the commits slowed down. Features stayed half-done. The project just sat there.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Worst Part? I Didn’t Know It Was Imposter Syndrome
&lt;/h2&gt;

&lt;p&gt;I thought I was being “careful.”&lt;/p&gt;

&lt;p&gt;I thought I was “thinking deeply.”&lt;/p&gt;

&lt;p&gt;I thought I was “waiting for clarity.”&lt;/p&gt;

&lt;p&gt;But in reality, I was stuck.&lt;/p&gt;

&lt;p&gt;Imposter syndrome doesn’t always show up as fear. Sometimes it shows up as perfectionism. Sometimes as endless research. Sometimes as “I’ll continue this once I’m more confident.”&lt;/p&gt;

&lt;p&gt;And that “later” never comes.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Breaking Point
&lt;/h2&gt;

&lt;p&gt;After a long gap, I revisited my project.&lt;/p&gt;

&lt;p&gt;I expected to feel the same confusion again.&lt;/p&gt;

&lt;p&gt;But something surprising happened.&lt;/p&gt;

&lt;p&gt;The architecture I chose?&lt;br&gt;
It wasn’t perfect… but it wasn’t wrong either.&lt;/p&gt;

&lt;p&gt;It was actually &lt;em&gt;good enough&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;That’s when it hit me:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I didn’t stop because the system was flawed.&lt;br&gt;
I stopped because I didn’t trust myself.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The Realization That Changed Everything
&lt;/h2&gt;

&lt;p&gt;I had been asking the wrong question.&lt;/p&gt;

&lt;p&gt;Instead of:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Is this the perfect architecture?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I should have been asking:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Is this good enough to move forward?”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Because here’s the truth:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You don’t validate architecture by thinking&lt;/li&gt;
&lt;li&gt;You validate it by building&lt;/li&gt;
&lt;li&gt;You validate it by breaking it&lt;/li&gt;
&lt;li&gt;You validate it by iterating&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;No amount of overthinking will replace real usage.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Trap of “What If I’m Wrong?”
&lt;/h2&gt;

&lt;p&gt;This is where most builders get stuck.&lt;/p&gt;

&lt;p&gt;You think:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What if I chose the wrong stack?&lt;/li&gt;
&lt;li&gt;What if this doesn’t scale?&lt;/li&gt;
&lt;li&gt;What if I have to rewrite everything later?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;But here’s the uncomfortable truth:&lt;/p&gt;

&lt;p&gt;You &lt;em&gt;will&lt;/em&gt; make wrong decisions.&lt;/p&gt;

&lt;p&gt;Everyone does.&lt;/p&gt;

&lt;p&gt;The difference is:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Some people learn by building&lt;/li&gt;
&lt;li&gt;Others stay stuck trying to avoid mistakes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And ironically, avoiding mistakes is the biggest mistake.&lt;/p&gt;




&lt;h2&gt;
  
  
  What I’m Doing Differently Now
&lt;/h2&gt;

&lt;p&gt;I made a simple decision:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I’m going to build first. Judge later.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Not blindly. Not carelessly. But without freezing myself.&lt;/p&gt;

&lt;p&gt;Here’s my current mindset:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Done &amp;gt; Perfect
&lt;/h3&gt;

&lt;p&gt;Shipping something imperfect teaches more than planning something perfect.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Architecture is not permanent
&lt;/h3&gt;

&lt;p&gt;You can refactor. You can rewrite. Nothing is locked forever.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Momentum matters more than correctness
&lt;/h3&gt;

&lt;p&gt;A moving project improves. A paused project dies.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Doubt is normal
&lt;/h3&gt;

&lt;p&gt;It doesn’t mean you’re wrong. It just means you care.&lt;/p&gt;




&lt;h2&gt;
  
  
  If You’re Building Something Right Now
&lt;/h2&gt;

&lt;p&gt;And you’ve paused…&lt;/p&gt;

&lt;p&gt;And you don’t know why…&lt;/p&gt;

&lt;p&gt;It might not be laziness.&lt;/p&gt;

&lt;p&gt;It might not be lack of skill.&lt;/p&gt;

&lt;p&gt;It might just be imposter syndrome.&lt;/p&gt;

&lt;p&gt;Ask yourself:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Did I stop because I truly don’t know what to do?&lt;/li&gt;
&lt;li&gt;Or did I stop because I’m afraid I might be wrong?&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Be honest.&lt;/p&gt;




&lt;h2&gt;
  
  
  One Small Shift
&lt;/h2&gt;

&lt;p&gt;Instead of saying:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I’ll continue once I’m confident”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Say:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“I’ll become confident &lt;em&gt;because&lt;/em&gt; I continue”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;That one shift changes everything.&lt;/p&gt;




&lt;h2&gt;
  
  
  Where I Am Now
&lt;/h2&gt;

&lt;p&gt;I’m back to building.&lt;/p&gt;

&lt;p&gt;Not because all my doubts are gone.&lt;br&gt;
But because I’ve stopped waiting for them to disappear.&lt;/p&gt;

&lt;p&gt;I don’t know if my decisions are perfect.&lt;/p&gt;

&lt;p&gt;But I know this:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Thinking won’t answer it. Building will.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;If you’re stuck in your project right now, this is your sign:&lt;/p&gt;

&lt;p&gt;Go back.&lt;br&gt;
Open the code.&lt;br&gt;
Ship something small.&lt;/p&gt;

&lt;p&gt;Not tomorrow. Today.&lt;/p&gt;

&lt;p&gt;Because the only way out of imposter syndrome…&lt;/p&gt;

&lt;p&gt;is through action.&lt;/p&gt;

&lt;p&gt;Keep moving.&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>webdev</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>HawkDoc: An Open Source Notion-Style Editor Built on Lexical</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Mon, 09 Mar 2026 14:46:34 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/hawkdoc-an-open-source-notion-style-editor-built-on-lexical-2p42</link>
      <guid>https://dev.to/elizabethsobiya/hawkdoc-an-open-source-notion-style-editor-built-on-lexical-2p42</guid>
      <description>&lt;p&gt;I was trying to use &lt;strong&gt;SuperDoc&lt;/strong&gt; for a project and kept running into limitations. Customisation was harder than expected and the performance was not where I needed it.&lt;/p&gt;

&lt;p&gt;So I decided to build my own editor called &lt;strong&gt;HawkDoc&lt;/strong&gt;, using Claude as a coding assistant for a large part of the development.&lt;/p&gt;

&lt;p&gt;HawkDoc focuses on &lt;strong&gt;fast document editing with zero-lag typing&lt;/strong&gt;. Many editors re-render large parts of the UI on every keystroke or ship heavy dependencies just to support basic formatting. I wanted something simpler and faster.&lt;/p&gt;

&lt;h2&gt;
  
  
  Tech Stack
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lexical (Meta)&lt;/strong&gt; as the editor engine. Its node-based architecture avoids full re-renders during formatting operations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Yjs + Hocuspocus&lt;/strong&gt; for real-time collaboration using CRDTs, allowing conflict-free document syncing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Redis + PostgreSQL&lt;/strong&gt; for storage. Yjs deltas are first written to Redis and flushed to Postgres every 30 seconds so the database does not receive keystroke-level writes.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;React + TypeScript&lt;/strong&gt; for the frontend UI.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;@react-pdf/renderer&lt;/strong&gt; for client-side PDF export with watermark support.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Works Today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Block-based editor&lt;/li&gt;
&lt;li&gt;Slash commands&lt;/li&gt;
&lt;li&gt;Template variable injection (&lt;code&gt;{{variable_name}}&lt;/code&gt; rendered as styled chips)&lt;/li&gt;
&lt;li&gt;Image uploads&lt;/li&gt;
&lt;li&gt;Markdown, HTML, and PDF export&lt;/li&gt;
&lt;li&gt;Auto-save&lt;/li&gt;
&lt;li&gt;Selection bubble menu&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  What Is Still in Progress
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Real-time collaboration UI&lt;/li&gt;
&lt;li&gt;Document workspace and file list&lt;/li&gt;
&lt;li&gt;DOCX import&lt;/li&gt;
&lt;li&gt;Version history&lt;/li&gt;
&lt;li&gt;Authentication UI (JWT backend already implemented)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Claude Code helped speed up a lot of the early development, especially when building the editor integrations and export pipeline.&lt;/p&gt;

&lt;p&gt;I would be curious to hear how other developers are using AI coding assistants when building new tools.&lt;/p&gt;

&lt;p&gt;The project is &lt;strong&gt;MIT licensed&lt;/strong&gt; and open for feedback and contributions.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://github.com/hawk-doc/hawkdoc" rel="noopener noreferrer"&gt;https://github.com/hawk-doc/hawkdoc&lt;/a&gt;&lt;/p&gt;

</description>
      <category>opensource</category>
      <category>react</category>
      <category>typescript</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Why SuperDoc Shows Only the Last Image: A DOCX Internals Investigation</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Mon, 02 Mar 2026 16:20:00 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/why-superdoc-shows-only-the-last-image-a-docx-internals-investigation-1afh</link>
      <guid>https://dev.to/elizabethsobiya/why-superdoc-shows-only-the-last-image-a-docx-internals-investigation-1afh</guid>
      <description>&lt;p&gt;While integrating DOCX generation into our document editor pipeline, I ran into one of the most confusing rendering issues I have seen so far.&lt;/p&gt;

&lt;p&gt;A DOCX generated with multiple images displayed perfectly in Word, LibreOffice, and Google Docs. But inside the SuperDoc editor, every image slot showed the same image. Always the last one.&lt;/p&gt;

&lt;p&gt;This post is not about a final fix yet. It is a breakdown of the debugging journey and what I discovered while tracing the root cause.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Symptom
&lt;/h2&gt;

&lt;p&gt;The generated report contained multiple property images arranged in a grid.&lt;/p&gt;

&lt;p&gt;Expected inside editor:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Image 1 → slot 1&lt;/li&gt;
&lt;li&gt;Image 2 → slot 2&lt;/li&gt;
&lt;li&gt;Image 3 → slot 3&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Actual result inside SuperDoc:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Slot 1 → last image&lt;/li&gt;
&lt;li&gt;Slot 2 → last image&lt;/li&gt;
&lt;li&gt;Slot 3 → last image&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Every slot displayed the same image.&lt;/p&gt;

&lt;p&gt;Strangely:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Microsoft Word → correct&lt;/li&gt;
&lt;li&gt;LibreOffice → correct&lt;/li&gt;
&lt;li&gt;Google Docs → correct&lt;/li&gt;
&lt;li&gt;SuperDoc editor → wrong&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So the DOCX itself was valid. The issue appeared editor-specific.&lt;/p&gt;




&lt;h2&gt;
  
  
  Environment
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Version&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;SuperDoc&lt;/td&gt;
&lt;td&gt;1.16.x&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;docx-templates&lt;/td&gt;
&lt;td&gt;4.15.0&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Node&lt;/td&gt;
&lt;td&gt;20.x&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Images inserted using &lt;code&gt;docx-templates&lt;/code&gt; loops and loaded into editor via &lt;code&gt;docxUrl&lt;/code&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  First Check: Is DOCX Corrupt?
&lt;/h2&gt;

&lt;p&gt;Initial assumption was that the DOCX generation might be broken.&lt;/p&gt;

&lt;p&gt;So I verified:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Opened in Word&lt;/li&gt;
&lt;li&gt;Opened in LibreOffice&lt;/li&gt;
&lt;li&gt;Converted to PDF&lt;/li&gt;
&lt;li&gt;Uploaded to Google Docs&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything rendered correctly everywhere except inside the editor.&lt;/p&gt;

&lt;p&gt;That ruled out basic DOCX corruption.&lt;/p&gt;




&lt;h2&gt;
  
  
  Deep Debugging Approach
&lt;/h2&gt;

&lt;p&gt;Since DOCX files are just zip archives, I extracted and inspected raw XML:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
word/document.xml
word/_rels/document.xml.rels
word/media/

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

&lt;/div&gt;



&lt;p&gt;Goal was to see how images were referenced internally.&lt;/p&gt;




&lt;h2&gt;
  
  
  Finding 1: Non-Standard Relationship IDs
&lt;/h2&gt;

&lt;p&gt;Normally DOCX uses relationship IDs like:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;



&lt;p&gt;But generated DOCX contained:&lt;br&gt;
&lt;/p&gt;

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

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

&lt;/div&gt;

&lt;p&gt;&lt;br&gt;
`&lt;/p&gt;

&lt;p&gt;Custom hash-based IDs.&lt;/p&gt;

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

&lt;p&gt;&lt;code&gt;&lt;/code&gt;&lt;code&gt;xml&lt;br&gt;
&amp;lt;Relationship Id="img2073076884"&lt;br&gt;
 Type=".../image"&lt;br&gt;
 Target="media/template_document.xml_img2073076884.jpg"/&amp;gt;&lt;br&gt;
&lt;/code&gt;&lt;code&gt;&lt;/code&gt;`&lt;/p&gt;

&lt;p&gt;This is valid but not standard.&lt;/p&gt;

&lt;h3&gt;
  
  
  Test performed
&lt;/h3&gt;

&lt;p&gt;Converted all relationship IDs to standard &lt;code&gt;rId1&lt;/code&gt;, &lt;code&gt;rId2&lt;/code&gt;, etc and updated references.&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
No change in editor behaviour.&lt;br&gt;
All image slots still showed the last image.&lt;/p&gt;

&lt;p&gt;So relationships were not the main cause.&lt;/p&gt;




&lt;h2&gt;
  
  
  Finding 2: Media Filenames
&lt;/h2&gt;

&lt;p&gt;Generated filenames looked like:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
template_document.xml_img2073076884.jpg&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Instead of standard:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
image1.jpg&lt;br&gt;
image2.jpg&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Renamed them to standard format and updated references.&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
Still broken in editor.&lt;/p&gt;

&lt;p&gt;So filename convention was not the cause.&lt;/p&gt;




&lt;h2&gt;
  
  
  Finding 3: Images Inside Tables?
&lt;/h2&gt;

&lt;p&gt;Another suspicion was that images inside table cells were being flattened or merged.&lt;/p&gt;

&lt;p&gt;Checked raw XML structure.&lt;/p&gt;

&lt;p&gt;Images were already in standalone paragraphs.&lt;br&gt;
Not nested inside complex table drawing structures.&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
No structural issue found.&lt;/p&gt;




&lt;h2&gt;
  
  
  Finding 4: Base64 External References
&lt;/h2&gt;

&lt;p&gt;As a further isolation step, I also converted images to base64-encoded external references to rule out any media file resolution issue inside the editor.&lt;/p&gt;

&lt;p&gt;Result:&lt;br&gt;
Still broken. All slots continued showing the last image.&lt;/p&gt;

&lt;p&gt;At this point, the problem had to be in how the editor was interpreting drawing node identity, not how images were stored or referenced.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Strongest Lead So Far (Unverified)
&lt;/h2&gt;

&lt;p&gt;While inspecting drawing XML for each image, one pattern appeared:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`xml&lt;br&gt;
&amp;lt;pic:cNvPr id="0" name="image1.jpg"/&amp;gt;&lt;br&gt;
&amp;lt;pic:cNvPr id="0" name="image2.jpg"/&amp;gt;&lt;br&gt;
&amp;lt;pic:cNvPr id="0" name="image3.jpg"/&amp;gt;&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Every image had:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;`&lt;br&gt;
id="0"&lt;br&gt;
`&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;According to the OOXML spec, this attribute is meant to be a unique identifier per drawing object within a document.&lt;/p&gt;

&lt;p&gt;But &lt;code&gt;docx-templates&lt;/code&gt; appears to be assigning &lt;code&gt;id="0"&lt;/code&gt; to all generated images.&lt;/p&gt;

&lt;p&gt;My working theory: SuperDoc uses ProseMirror under the hood for document rendering. If ProseMirror or SuperDoc's DOCX parser is using &lt;code&gt;pic:cNvPr id&lt;/code&gt; to distinguish drawing nodes, duplicate IDs across all images could cause it to treat them as the same node, with the last image loaded winning every slot.&lt;/p&gt;

&lt;p&gt;That said, this is a hypothesis, not a confirmed fix. The next step is to patch &lt;code&gt;docx-templates&lt;/code&gt; output to inject unique sequential IDs, do a clean server restart, and verify the result properly. A failed test earlier in this session turned out to be against old compiled code because the server hadn't been restarted after a rebuild.&lt;/p&gt;




&lt;h2&gt;
  
  
  What Has Been Tried So Far
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Attempt&lt;/th&gt;
&lt;th&gt;Result&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Extract images from table&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rename relationship IDs to rId1/rId2&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Rename media filenames to image1.jpg&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Convert images to base64 external refs&lt;/td&gt;
&lt;td&gt;No change&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Inspect drawing XML&lt;/td&gt;
&lt;td&gt;Found duplicate &lt;code&gt;id="0"&lt;/code&gt; across all images&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Patch to unique IDs&lt;/td&gt;
&lt;td&gt;Not fully verified yet&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  Current Status
&lt;/h2&gt;

&lt;p&gt;Issue is still under investigation.&lt;/p&gt;

&lt;p&gt;Leading hypothesis: duplicate &lt;code&gt;pic:cNvPr id="0"&lt;/code&gt; across all images is causing the editor to collapse them into a single node.&lt;/p&gt;

&lt;p&gt;Next step: inject unique IDs, do a full server restart, and run a clean verification.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lessons From This Debugging Session
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. If it works in Word, it can still be wrong
&lt;/h3&gt;

&lt;p&gt;Word tolerates many OOXML violations silently. Editors and converters are stricter. Never assume Word rendering equals correctness.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Always inspect DOCX internally
&lt;/h3&gt;

&lt;p&gt;DOCX debugging becomes much faster once you treat it as a zip file. Unzip it, inspect the XML, search for patterns, verify structure.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Rendering engines behave differently
&lt;/h3&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Tool&lt;/th&gt;
&lt;th&gt;Strictness&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Word&lt;/td&gt;
&lt;td&gt;Very forgiving&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Google Docs&lt;/td&gt;
&lt;td&gt;Moderate&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;LibreOffice&lt;/td&gt;
&lt;td&gt;Strict&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Editor engines&lt;/td&gt;
&lt;td&gt;Very strict&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;Editor-specific bugs often come from structural assumptions the spec makes but Word quietly ignores.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why I'm Documenting This
&lt;/h2&gt;

&lt;p&gt;This bug is still unresolved. But the debugging journey itself surfaced important learnings about DOCX internals, rendering engine strictness, and real-world document pipelines.&lt;/p&gt;

&lt;p&gt;If you've encountered similar behaviour with DOCX image rendering, I'd genuinely like to hear what you found.&lt;/p&gt;

</description>
      <category>devjournal</category>
      <category>programming</category>
      <category>softwaredevelopment</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>Microservices: Not Just an Architecture, but a Way of Thinking</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Tue, 03 Feb 2026 13:04:27 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/microservices-not-just-an-architecture-but-a-way-of-thinking-2m7</link>
      <guid>https://dev.to/elizabethsobiya/microservices-not-just-an-architecture-but-a-way-of-thinking-2m7</guid>
      <description>&lt;p&gt;There is a moment in every developer’s journey where a single codebase starts to feel heavy. Small changes take longer. Deployments feel risky. One bug fix somehow breaks three unrelated features. That is usually when the word &lt;em&gt;microservices&lt;/em&gt; enters the conversation.&lt;/p&gt;

&lt;p&gt;Microservices are often introduced as a solution, but they are not magic. They are a mindset shift.&lt;/p&gt;

&lt;p&gt;Instead of building one large system that does everything, microservices encourage us to build small, focused services that do one thing well, and communicate clearly with others.&lt;/p&gt;

&lt;p&gt;At first, this sounds like extra work. More repos, more deployments, more coordination. And honestly, it is. But when done for the right reasons, the payoff is real.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why Microservices Exist (And When They Make Sense)
&lt;/h2&gt;

&lt;p&gt;Microservices were born out of pain. Pain from scaling teams, not just servers.&lt;/p&gt;

&lt;p&gt;When multiple teams work on the same monolith:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Merge conflicts increase&lt;/li&gt;
&lt;li&gt;Release cycles slow down&lt;/li&gt;
&lt;li&gt;One change requires everyone’s approval&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Microservices help by giving teams ownership. Each service has:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A clear responsibility&lt;/li&gt;
&lt;li&gt;Its own lifecycle&lt;/li&gt;
&lt;li&gt;Freedom to evolve independently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;That said, microservices are not for every project. If you are a small team or still validating a product, a well-structured monolith is often the smarter choice. Microservices shine when:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The domain is complex&lt;/li&gt;
&lt;li&gt;Teams need autonomy&lt;/li&gt;
&lt;li&gt;Scalability and reliability really matter&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What a Microservice Really Is
&lt;/h2&gt;

&lt;p&gt;A microservice is not just a smaller backend.&lt;/p&gt;

&lt;p&gt;A true microservice:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Owns its own data&lt;/li&gt;
&lt;li&gt;Has a single, well-defined purpose&lt;/li&gt;
&lt;li&gt;Communicates via APIs or events&lt;/li&gt;
&lt;li&gt;Can be deployed independently&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Think of it like a team member. You do not want one person doing everything. You want people who are clear about their role, dependable, and easy to collaborate with.&lt;/p&gt;




&lt;h2&gt;
  
  
  How to Start Exploring Microservices Without Overwhelm
&lt;/h2&gt;

&lt;p&gt;You do not need to rebuild everything to learn microservices.&lt;/p&gt;

&lt;p&gt;Here are practical ways to explore them safely:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Start by Splitting by Responsibility
&lt;/h3&gt;

&lt;p&gt;Look at your current system and ask:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Authentication&lt;/li&gt;
&lt;li&gt;Payments&lt;/li&gt;
&lt;li&gt;Notifications&lt;/li&gt;
&lt;li&gt;Reporting&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These are natural boundaries. Even mentally separating them helps you understand service boundaries.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Build One Service Independently
&lt;/h3&gt;

&lt;p&gt;Pick one small feature and build it as a separate service:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A notification service&lt;/li&gt;
&lt;li&gt;A file processing service&lt;/li&gt;
&lt;li&gt;A background job worker&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Deploy it independently. Observe how it feels to version, test, and scale it alone.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Learn Communication Patterns
&lt;/h3&gt;

&lt;p&gt;Microservices live and die by communication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;REST APIs for simplicity&lt;/li&gt;
&lt;li&gt;Async messaging for scalability&lt;/li&gt;
&lt;li&gt;Events for loose coupling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Understanding when to use which is more important than choosing the “best” tool.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Embrace Observability Early
&lt;/h3&gt;

&lt;p&gt;Logs, metrics, and tracing are not optional here. When things go wrong in microservices, visibility is your safety net.&lt;/p&gt;




&lt;h2&gt;
  
  
  The Hidden Lesson Microservices Teach
&lt;/h2&gt;

&lt;p&gt;The biggest thing microservices teach is discipline.&lt;/p&gt;

&lt;p&gt;You are forced to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Define clear contracts&lt;/li&gt;
&lt;li&gt;Respect boundaries&lt;/li&gt;
&lt;li&gt;Write better documentation&lt;/li&gt;
&lt;li&gt;Think about failures upfront&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Even if you never fully adopt microservices, this way of thinking makes you a better engineer.&lt;/p&gt;




&lt;h2&gt;
  
  
  Final Thoughts
&lt;/h2&gt;

&lt;p&gt;Microservices are not a destination. They are a tool, and like all tools, they work best when used with intention.&lt;/p&gt;

&lt;p&gt;If you are curious, start small. Experiment. Break things in side projects. Learn why companies chose this path, and also why some walked back.&lt;/p&gt;

&lt;p&gt;And if nothing else, let microservices remind you of this simple truth:&lt;/p&gt;

&lt;p&gt;Good software is less about size, and more about clarity.&lt;/p&gt;




</description>
      <category>architecture</category>
      <category>microservices</category>
      <category>softwaredevelopment</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Understanding Session Storage in Web Development: Pros, Cons, and Implementations</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Tue, 22 Jul 2025 15:06:48 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/understanding-session-storage-in-web-development-pros-cons-and-implementations-2b48</link>
      <guid>https://dev.to/elizabethsobiya/understanding-session-storage-in-web-development-pros-cons-and-implementations-2b48</guid>
      <description>&lt;p&gt;Managing user data on the client side is crucial for modern web applications. One of the most important—yet often misunderstood—features for temporary client-side storage is &lt;strong&gt;session storage&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;In this post, you'll learn what session storage is, how to implement it, and when to use it effectively by weighing its advantages and disadvantages.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 What Is Session Storage?
&lt;/h2&gt;

&lt;p&gt;Session storage is part of the Web Storage API that lets you store key-value pairs &lt;strong&gt;temporarily in a user’s browser&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Unlike &lt;strong&gt;local storage&lt;/strong&gt;—which persists data until explicitly deleted—data in session storage is cleared automatically when the &lt;strong&gt;tab or browser window is closed&lt;/strong&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔑 Key Highlights
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scope:&lt;/strong&gt; Isolated to a specific browser tab or window&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Persistence:&lt;/strong&gt; Automatically cleared on tab/window close&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Capacity:&lt;/strong&gt; Typically 5–10 MB per origin&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Access:&lt;/strong&gt; Restricted by the &lt;strong&gt;same-origin policy&lt;/strong&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🎯 Why Use Session Storage?
&lt;/h2&gt;

&lt;p&gt;Session storage is ideal when data is &lt;strong&gt;temporary&lt;/strong&gt; and shouldn’t persist beyond a single session.&lt;/p&gt;

&lt;h3&gt;
  
  
  ✅ Common Use Cases:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Multi-step forms:&lt;/strong&gt; Preserve form inputs across steps or accidental reloads&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Shopping carts:&lt;/strong&gt; Keep selected items while users browse&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Auth tokens:&lt;/strong&gt; Store temporary tokens without cross-tab sharing&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;UI preferences:&lt;/strong&gt; Save temporary states like sidebar collapse or themes&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🛠️ Basic Implementation
&lt;/h2&gt;

&lt;p&gt;Session storage is super easy to use. Here's a basic breakdown:&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;// Store data&lt;/span&gt;
&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&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="s1"&gt;value&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Retrieve data&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;value&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Remove a specific item&lt;/span&gt;
&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;key&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Clear all session storage&lt;/span&gt;
&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;clear&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;📝 Note: Session storage only stores &lt;strong&gt;strings&lt;/strong&gt;. For objects or arrays, use &lt;code&gt;JSON.stringify()&lt;/code&gt; before saving and &lt;code&gt;JSON.parse()&lt;/code&gt; when retrieving.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  🎨 Example: Saving a UI Theme
&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;// Set dark theme&lt;/span&gt;
&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme&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="s1"&gt;dark&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="c1"&gt;// Retrieve theme&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// 'dark'&lt;/span&gt;

&lt;span class="c1"&gt;// Remove theme&lt;/span&gt;
&lt;span class="nx"&gt;sessionStorage&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;theme&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  📈 Pros &amp;amp; Cons of Session Storage
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;✅ &lt;strong&gt;Pros&lt;/strong&gt;
&lt;/th&gt;
&lt;th&gt;❌ &lt;strong&gt;Cons&lt;/strong&gt;
&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Tab-level isolation (no cross-tab sharing)&lt;/td&gt;
&lt;td&gt;Data is lost when tab/window is closed&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Larger capacity than cookies (5–10 MB)&lt;/td&gt;
&lt;td&gt;Not suitable for persistent or critical data&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Automatic cleanup (no need to manage expiry)&lt;/td&gt;
&lt;td&gt;Cannot share state between tabs/windows&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Simple, synchronous API&lt;/td&gt;
&lt;td&gt;Vulnerable to XSS if inputs aren’t sanitized&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Reduces server load for temporary data&lt;/td&gt;
&lt;td&gt;Blocking issues if used for large data due to synchronous nature&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Useful for one-tab-only auth/token scenarios&lt;/td&gt;
&lt;td&gt;Not supported in some very old browsers&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;




&lt;h2&gt;
  
  
  🔐 Security Considerations
&lt;/h2&gt;

&lt;p&gt;Since session storage is entirely client-side:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Never&lt;/strong&gt; store sensitive data like passwords or payment details.&lt;/li&gt;
&lt;li&gt;Be cautious of &lt;strong&gt;XSS attacks&lt;/strong&gt;—sanitize inputs and validate data.&lt;/li&gt;
&lt;li&gt;If you're handling authentication, prefer &lt;strong&gt;secure, HttpOnly cookies&lt;/strong&gt; for persistent or sensitive tokens.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧠 When to Use Session Storage
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;✅ Ideal When:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need &lt;strong&gt;temporary data&lt;/strong&gt; storage (e.g., form inputs, temporary tokens)&lt;/li&gt;
&lt;li&gt;You want to &lt;strong&gt;prevent cross-tab sharing&lt;/strong&gt; (e.g., multi-login environments)&lt;/li&gt;
&lt;li&gt;You’re handling &lt;strong&gt;non-sensitive&lt;/strong&gt;, short-lived UI states&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;🚫 Avoid When:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You need data persistence across sessions or tabs&lt;/li&gt;
&lt;li&gt;The data must be available on the server (cookies are better here)&lt;/li&gt;
&lt;li&gt;You’re storing &lt;strong&gt;sensitive&lt;/strong&gt; information&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🧪 Best Practices
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;JSON.stringify()&lt;/code&gt; complex data before saving&lt;/li&gt;
&lt;li&gt;Handle quota errors gracefully (especially in Safari/private mode)&lt;/li&gt;
&lt;li&gt;Clean up unused session data to prevent clutter&lt;/li&gt;
&lt;li&gt;Always test across browsers for compatibility&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  ✅ Conclusion
&lt;/h2&gt;

&lt;p&gt;Session storage is a powerful, lightweight tool for handling &lt;strong&gt;temporary, tab-specific&lt;/strong&gt; data. Used properly, it enhances UX, improves performance, and simplifies state management.&lt;/p&gt;

&lt;p&gt;But remember—it’s not a one-size-fits-all solution. Always evaluate the nature of your data, persistence needs, and security before deciding on your storage strategy.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React Design Patterns That’ll Make You a Better Dev</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Thu, 01 May 2025 11:41:48 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/react-design-patterns-thatll-make-you-a-better-dev-1l52</link>
      <guid>https://dev.to/elizabethsobiya/react-design-patterns-thatll-make-you-a-better-dev-1l52</guid>
      <description>&lt;p&gt;Hey folks! 👋&lt;/p&gt;

&lt;p&gt;If you've been working with React for a bit, you’ve probably heard people throw around terms like &lt;strong&gt;HOC&lt;/strong&gt;, &lt;strong&gt;Render Props&lt;/strong&gt;, &lt;strong&gt;Container-Presenter&lt;/strong&gt;, or even &lt;strong&gt;Compound Components&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;Sounds fancy, right? But what do these &lt;em&gt;actually&lt;/em&gt; mean—and more importantly—&lt;strong&gt;why should you care&lt;/strong&gt;?&lt;/p&gt;

&lt;p&gt;Let’s break down a few common &lt;strong&gt;React design patterns&lt;/strong&gt;, no theory overload, just straight-up use cases and examples you’d see in your day-to-day code.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧱 1. Container and Presentational Pattern
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Split components by &lt;em&gt;logic&lt;/em&gt; (container) and &lt;em&gt;UI&lt;/em&gt; (presentational).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Keeps things clean. Easy to test, reuse, and manage.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Container&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;UserContainer&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setUser&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&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="nf"&gt;fetchUser&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;setUser&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="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;UserProfile&lt;/span&gt; &lt;span class="na"&gt;user&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Presentational&lt;/span&gt;
&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;UserProfile&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;user&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Loading...&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;p&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;user&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;✔️ Logic stays in one place.&lt;br&gt;&lt;br&gt;
✔️ UI stays dumb and pretty.&lt;/p&gt;


&lt;h2&gt;
  
  
  🌀 2. Higher Order Components (HOC)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
A function that takes a component and returns a new one with extra powers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Great for code reuse (e.g., auth, logging, theming).&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;withLogger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;WrappedComponent&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="kd"&gt;function&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="nf"&gt;useEffect&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Component loaded!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[]);&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;WrappedComponent&lt;/span&gt; &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;...&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;;&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;FancyButtonWithLog&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;withLogger&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;FancyButton&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;⚠️ Be careful: Too many HOCs = wrapper hell.&lt;/p&gt;




&lt;h2&gt;
  
  
  🔁 3. Render Props
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
You pass a function as a prop and call it inside the component to render stuff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Flexible. Cleaner than HOCs in some cases.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;MouseTracker&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;render&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setPos&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;

  &lt;span class="nf"&gt;useEffect&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;handler&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setPos&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientX&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;y&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;e&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;clientY&lt;/span&gt; &lt;span class="p"&gt;});&lt;/span&gt;
    &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mousemove&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handler&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;gt;&lt;/span&gt; &lt;span class="nb"&gt;window&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;removeEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;mousemove&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;handler&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="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;render&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;pos&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;MouseTracker&lt;/span&gt; &lt;span class="na"&gt;render&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;y&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;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;x&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;, &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;y&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🧠 Think of it like passing a component’s brain to another component’s face.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧩 4. Compound Components
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;What it is:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Multiple components that work together using React context.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why:&lt;/strong&gt;&lt;br&gt;&lt;br&gt;
Great for building reusable UI libraries or dynamic forms.&lt;/p&gt;

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

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;Tabs&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="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setActive&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;TabContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt; &lt;span class="na"&gt;value&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setActive&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;TabContext&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Provider&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Tab&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;index&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setActive&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TabContext&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;onClick&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setActive&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;index&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;style&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;fontWeight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bold&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="s1"&gt;normal&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;Panel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;index&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;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;active&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useContext&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;TabContext&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;active&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;index&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;children&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;null&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;Use like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tab&lt;/span&gt; &lt;span class="na"&gt;index&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Home&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tab&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tab&lt;/span&gt; &lt;span class="na"&gt;index&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Profile&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Tab&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Panel&lt;/span&gt; &lt;span class="na"&gt;index&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Welcome Home&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Panel&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Panel&lt;/span&gt; &lt;span class="na"&gt;index&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Your Profile&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;Panel&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Tabs&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;🚀 Fancy but powerful. Think Lego bricks that click together.&lt;/p&gt;




&lt;h2&gt;
  
  
  🧠 TL;DR
&lt;/h2&gt;

&lt;p&gt;React design patterns aren’t magic—they’re just better ways to &lt;strong&gt;organize your components and logic&lt;/strong&gt; so your code stays readable and maintainable.&lt;/p&gt;

&lt;p&gt;If you’ve made it this far, you’ve already used these patterns at some point—even if you didn’t know their names. 💡&lt;/p&gt;

&lt;p&gt;Let me know in the comments which one you use the most—or if there’s one you want me to explain with memes and analogies next time 😄&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Getting Started with Yup Validations in React: A Beginner's Guide</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Sun, 28 Jul 2024 14:14:40 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/getting-started-with-yup-validations-in-react-a-beginners-guide-4ec7</link>
      <guid>https://dev.to/elizabethsobiya/getting-started-with-yup-validations-in-react-a-beginners-guide-4ec7</guid>
      <description>&lt;p&gt;Hey there, fellow developers! 👋 If you've been working with forms in React, you know how tedious validation can get. But fear not! Today, we're diving into Yup, a JavaScript schema builder for value parsing and validation. Yup makes form validation in React a breeze. Let’s break it down step-by-step in a beginner-friendly way.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Yup?
&lt;/h2&gt;

&lt;p&gt;Yup is a JavaScript library that helps you define and validate data schemas. Think of it as a tool that ensures the data your forms receive is exactly as expected. Whether you need to check if an email is valid or if a password meets certain criteria, Yup has you covered.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Use Yup?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Simplicity&lt;/strong&gt;: Define complex validation logic with straightforward, readable code.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Integration&lt;/strong&gt;: Works seamlessly with form libraries like Formik.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;: Easily create custom validation methods.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installing Yup
&lt;/h2&gt;

&lt;p&gt;First things first, let’s get Yup installed in your React project. You can do this using npm or yarn:&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;yup
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Basic Usage of Yup
&lt;/h2&gt;

&lt;p&gt;Let’s start with a simple example to understand how Yup works. Suppose we have a form where we need to validate an email and a password.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Import Yup
&lt;/h3&gt;

&lt;p&gt;In your React component, import Yup:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yup&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Define Your Schema
&lt;/h3&gt;

&lt;p&gt;Next, define a validation schema for your form data. Here’s an example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;validationSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid email address&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Email is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Password must be at least 6 characters&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Password is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Validate Data
&lt;/h3&gt;

&lt;p&gt;Now, you can use this schema to validate your form data. Here’s a basic example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;formData&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user@example.com&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;password123&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;

&lt;span class="nx"&gt;validationSchema&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;formData&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;valid&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Validation passed:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;valid&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="k"&gt;catch&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Validation failed:&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Using Yup with Formik
&lt;/h2&gt;

&lt;p&gt;Formik is a popular library for managing form state in React. Yup integrates beautifully with Formik, making form validation even simpler.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 1: Install Formik
&lt;/h3&gt;

&lt;p&gt;First, install Formik:&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;formik
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

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

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Create a Form with Formik and Yup
&lt;/h3&gt;

&lt;p&gt;Here’s a complete example of how to use Formik with Yup for form validation:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="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="s1"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Formik&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Field&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ErrorMessage&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;formik&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yup&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SignupSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid email&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Password too short&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyForm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Signup&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Formik&lt;/span&gt;
      &lt;span class="na"&gt;initialValues&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;''&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;validationSchema&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;SignupSchema&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
      &lt;span class="na"&gt;onSubmit&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;values&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
      &lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;errors&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;touched&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="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Email&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Field&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"div"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Password&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Field&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
            &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;ErrorMessage&lt;/span&gt; &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"password"&lt;/span&gt; &lt;span class="na"&gt;component&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"div"&lt;/span&gt; &lt;span class="p"&gt;/&amp;gt;&lt;/span&gt;
          &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;

          &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;type&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Form&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Formik&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;MyForm&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:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Define the Schema&lt;/strong&gt;: Using Yup, we define the rules for the email and password fields.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Setup Formik&lt;/strong&gt;: We initialize Formik with the schema and initial values.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Render the Form&lt;/strong&gt;: We use Formik’s components to create the form, displaying validation errors using &lt;code&gt;ErrorMessage&lt;/code&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Real-World Use Cases for Yup
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;User Registration Forms&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;When registering users, it’s essential to validate their input. Yup can ensure the email is valid, the password meets complexity requirements, and usernames are not empty.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;registrationSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Username is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;email&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Invalid email&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Email is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;password&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;min&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Password must be at least 8 characters&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Password is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2. &lt;strong&gt;Complex Nested Forms&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Yup can handle nested objects and arrays, making it perfect for forms that require detailed and complex validation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;profileSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Name is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="na"&gt;address&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="na"&gt;street&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Street is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;city&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;City is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="na"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;required&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;ZIP code is required&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
  &lt;span class="p"&gt;}),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. &lt;strong&gt;Custom Validation Logic&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Sometimes, you need custom validation. Yup allows you to create your own validation methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;customSchema&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;object&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;shape&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;username&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;Yup&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;string&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;test&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;is-john-doe&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="s1"&gt;Username cannot be John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;value&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;value&lt;/span&gt; &lt;span class="o"&gt;!==&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;John Doe&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Yup is a powerful library that makes form validation in React straightforward and efficient. By defining schemas and integrating with libraries like Formik, you can ensure that your forms are reliable and user-friendly.&lt;/p&gt;

&lt;p&gt;I hope this guide helps you get started with Yup. Happy coding! If you have any questions or need further clarification, feel free to ask in the comments below.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>javascript</category>
      <category>programming</category>
    </item>
    <item>
      <title>Understanding DNS: The Backbone of the Internet</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Sun, 09 Jun 2024 14:59:09 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/understanding-dns-the-backbone-of-the-internet-49d7</link>
      <guid>https://dev.to/elizabethsobiya/understanding-dns-the-backbone-of-the-internet-49d7</guid>
      <description>&lt;h1&gt;
  
  
  Understanding DNS: The Backbone of the Internet
&lt;/h1&gt;

&lt;p&gt;Hey, developers! Today, we're diving into a fundamental yet often overlooked part of the internet: the Domain Name System (DNS). Whether you're a seasoned developer or just starting out, understanding DNS is crucial for navigating the web and creating robust applications. So, let's break it down in simple terms and explore why DNS is so important.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is DNS?
&lt;/h2&gt;

&lt;p&gt;Imagine you're trying to visit a friend's house. You know their name, but you need their address to get there. DNS acts like the internet's phonebook, translating human-friendly domain names (like &lt;code&gt;www.example.com&lt;/code&gt;) into IP addresses (like &lt;code&gt;192.0.2.1&lt;/code&gt;) that computers use to identify each other on the network.&lt;/p&gt;

&lt;h2&gt;
  
  
  How Does DNS Work?
&lt;/h2&gt;

&lt;p&gt;When you type a URL into your browser, several steps happen behind the scenes:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Querying the Resolver&lt;/strong&gt;: Your computer contacts a DNS resolver, usually provided by your internet service provider (ISP), asking for the IP address of the domain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Checking the Cache&lt;/strong&gt;: The resolver first checks its cache to see if it already knows the IP address. If it does, it returns the address immediately.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Recursive Queries&lt;/strong&gt;: If the address isn't in the cache, the resolver performs a series of queries. It starts by asking one of the root DNS servers, which knows where to find top-level domain (TLD) servers (like &lt;code&gt;.com&lt;/code&gt;, &lt;code&gt;.org&lt;/code&gt;, etc.).&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;TLD Servers&lt;/strong&gt;: The root server directs the resolver to the appropriate TLD server, which in turn points to the authoritative DNS server for the specific domain.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Authoritative DNS Server&lt;/strong&gt;: The authoritative server holds the DNS records for the domain and responds with the IP address.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Returning the IP Address&lt;/strong&gt;: The resolver sends the IP address back to your computer, which then uses it to connect to the website's server.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Types of DNS Records
&lt;/h2&gt;

&lt;p&gt;DNS records are stored in the authoritative servers and contain various pieces of information about the domain. Here are some common types:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;A Record&lt;/strong&gt;: Maps a domain to an IPv4 address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AAAA Record&lt;/strong&gt;: Maps a domain to an IPv6 address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CNAME Record&lt;/strong&gt;: Alias of one name to another (e.g., &lt;code&gt;www.example.com&lt;/code&gt; to &lt;code&gt;example.com&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;MX Record&lt;/strong&gt;: Specifies mail servers for the domain.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;TXT Record&lt;/strong&gt;: Holds text information, often used for verification and security purposes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Why DNS Matters
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;User Experience&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;DNS makes it easy for users to access websites using memorable domain names instead of complex IP addresses. Imagine if you had to remember &lt;code&gt;172.217.5.110&lt;/code&gt; instead of &lt;code&gt;www.google.com&lt;/code&gt;!&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Scalability&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;DNS allows websites to use multiple servers across different locations. This helps distribute the load and improves performance, making the internet scalable and efficient.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Security&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;DNS can enhance security through features like DNSSEC (Domain Name System Security Extensions), which helps protect against certain types of attacks by ensuring the responses from DNS servers are authentic.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. &lt;strong&gt;Email Delivery&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;DNS plays a crucial role in email delivery. MX records ensure that emails are routed to the correct mail servers, helping maintain reliable communication.&lt;/p&gt;

&lt;h2&gt;
  
  
  Real-World Example: Setting Up a DNS Record
&lt;/h2&gt;

&lt;p&gt;Let's say you've just launched a new website and want to link your domain name to your web server's IP address. Here's a simplified step-by-step guide:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Register Your Domain&lt;/strong&gt;: Choose and register your domain name with a domain registrar.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find Your DNS Settings&lt;/strong&gt;: Log into your domain registrar's control panel and find the DNS settings.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Add an A Record&lt;/strong&gt;: Create a new A record and enter your web server's IP address.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Save Changes&lt;/strong&gt;: Save your changes and wait for them to propagate (this can take anywhere from a few minutes to 48 hours).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Test Your Setup&lt;/strong&gt;: Open your browser and type your domain name. If everything is set up correctly, you should see your website.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;DNS is an essential part of the internet's infrastructure, enabling us to use easy-to-remember domain names to access websites. Understanding how DNS works can help you troubleshoot issues, improve website performance, and enhance security.&lt;/p&gt;

&lt;p&gt;So next time you type a URL into your browser, take a moment to appreciate the complex system working behind the scenes to connect you to the right website. Happy coding!&lt;/p&gt;

&lt;p&gt;Feel free to share your thoughts and questions in the comments below. Let's keep learning together!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Unlocking Real-Time Chat with GetStream.io: A Developer's Guide 💬</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Wed, 05 Jun 2024 14:09:02 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/unlocking-real-time-chat-with-getstreamio-a-developers-guide-1noh</link>
      <guid>https://dev.to/elizabethsobiya/unlocking-real-time-chat-with-getstreamio-a-developers-guide-1noh</guid>
      <description>&lt;p&gt;In today's fast-paced digital world, real-time communication is key. Whether you're building a messaging app, a social media platform, or a customer support system, integrating a reliable and scalable chat solution is crucial. This is where &lt;a href="https://getstream.io"&gt;GetStream.io&lt;/a&gt; comes into play. GetStream.io offers a robust chat API that makes it easy to add real-time chat functionality to your applications. In this post, we'll explore how to leverage GetStream.io to create seamless and engaging chat experiences.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Choose GetStream.io?
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. &lt;strong&gt;Scalability and Performance&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;GetStream.io is designed to handle millions of concurrent users, ensuring your chat application can scale effortlessly as your user base grows. The API is built with performance in mind, providing low-latency communication that's crucial for real-time interactions.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. &lt;strong&gt;Feature-Rich Chat API&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;GetStream.io offers a plethora of features out-of-the-box, including:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Real-time messaging&lt;/strong&gt;: Instant delivery of messages.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;User presence&lt;/strong&gt;: Show when users are online or offline.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Typing indicators&lt;/strong&gt;: Notify users when someone is typing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Message history&lt;/strong&gt;: Persist and retrieve past conversations.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push notifications&lt;/strong&gt;: Keep users engaged with timely alerts.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  3. &lt;strong&gt;Easy Integration&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;With well-documented SDKs and APIs for various platforms (JavaScript, iOS, Android, and more), integrating GetStream.io into your application is straightforward. You can quickly get up and running with minimal setup.&lt;/p&gt;

&lt;h2&gt;
  
  
  Getting Started with GetStream.io
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Sign Up and Create an App
&lt;/h3&gt;

&lt;p&gt;First, you'll need to sign up for a GetStream.io account. Once you've registered, create a new app in the GetStream.io dashboard. This will provide you with the necessary API keys to connect your application to the GetStream.io service.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Install the SDK
&lt;/h3&gt;

&lt;p&gt;Next, install the GetStream.io SDK for your platform. For a React application, you can use the following command:&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;stream-chat-react
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 3: Initialize the Client
&lt;/h3&gt;

&lt;p&gt;Initialize the GetStream.io client in your application using the API key you received:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;StreamChat&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stream-chat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;StreamChat&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getInstance&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;YOUR_API_KEY&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 4: Connect a User
&lt;/h3&gt;

&lt;p&gt;To interact with the chat service, you'll need to connect a user. You'll typically do this after a user logs into your application:&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;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;connectUser&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;user-id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;User Name&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://path-to-avatar/image.jpg&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt;
  &lt;span class="nx"&gt;userToken&lt;/span&gt; &lt;span class="c1"&gt;// Token generated for the user&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 5: Create or Join a Channel
&lt;/h3&gt;

&lt;p&gt;Now, let's create or join a chat channel:&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;const&lt;/span&gt; &lt;span class="nx"&gt;channel&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;messaging&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="s1"&gt;channel-id&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;General Chat&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;watch&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 6: Send and Receive Messages
&lt;/h3&gt;

&lt;p&gt;With the channel set up, you can now send and receive messages:&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;// Sending a message&lt;/span&gt;
&lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;sendMessage&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;text&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Hello, world!&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;

&lt;span class="c1"&gt;// Receiving messages&lt;/span&gt;
&lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;on&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;message.new&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;event&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 7: Implement UI Components
&lt;/h3&gt;

&lt;p&gt;GetStream.io provides pre-built React components for common chat features, making it easy to create a polished chat interface. Here's a basic example using the &lt;code&gt;Channel&lt;/code&gt; and &lt;code&gt;MessageList&lt;/code&gt; 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="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;Chat&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Channel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;ChannelHeader&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;MessageList&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;MessageInput&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stream-chat-react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;stream-chat-react/dist/css/index.css&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;Chat&lt;/span&gt; &lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;client&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="nx"&gt;theme&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;messaging light&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;Channel&lt;/span&gt; &lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;channel&lt;/span&gt;&lt;span class="p"&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;ChannelHeader&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;MessageList&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;MessageInput&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;/Channel&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;/Chat&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Integrating real-time chat into your application has never been easier thanks to GetStream.io. With its powerful API, scalability, and ease of use, you can quickly add chat functionality to your app and create engaging, real-time experiences for your users. Whether you're building a small project or a large-scale application, GetStream.io has the tools you need to succeed.&lt;/p&gt;

&lt;p&gt;Ready to get started? Head over to &lt;a href="https://getstream.io"&gt;GetStream.io&lt;/a&gt; and start building your real-time chat application today!&lt;/p&gt;

&lt;p&gt;Feel free to share your experiences and any questions you have in the comments below. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Unraveling Currying in JavaScript: A Beginner's Guide with Real-World Examples</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Sun, 19 May 2024 15:03:50 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/unraveling-currying-in-javascript-a-beginners-guide-with-real-world-examples-4gk</link>
      <guid>https://dev.to/elizabethsobiya/unraveling-currying-in-javascript-a-beginners-guide-with-real-world-examples-4gk</guid>
      <description>&lt;p&gt;Hey there, fellow devs! Today, we're diving into a fascinating and powerful concept in JavaScript called currying. If you've ever wondered how to make your functions more flexible and reusable, this post is for you. We'll break down what currying is, why it's useful, and how to implement it with easy-to-follow examples. Let's get started! 🚀&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Currying?
&lt;/h2&gt;

&lt;p&gt;Currying is a functional programming technique that transforms a function with multiple arguments into a sequence of functions, each taking a single argument. In simpler terms, it means breaking down a function that takes several arguments into a series of functions that each take one argument and return another function.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Use Currying?
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Reusability&lt;/strong&gt;: Currying allows you to create reusable, more specific functions from general functions.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Readability&lt;/strong&gt;: Curried functions can make your code more readable and expressive.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Partial Application&lt;/strong&gt;: Currying makes it easy to fix some arguments of a function and generate a new function.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Currying in Action
&lt;/h2&gt;

&lt;p&gt;Let's start with a simple example to illustrate currying in JavaScript.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 1: Basic Currying with Volume Calculation
&lt;/h3&gt;

&lt;p&gt;Suppose we have a function that calculates the volume of a box given its length, width, and height:&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;calculateVolume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;length&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;height&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;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;height&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nf"&gt;calculateVolume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&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="c1"&gt;// Output: 60&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's transform this function into a curried version:&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;curriedVolume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;length&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="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;width&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="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;height&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;length&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;width&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;height&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="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;volumeWithLength3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;curriedVolume&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;volumeWithLength3AndWidth4&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;volumeWithLength3&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="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="nf"&gt;volumeWithLength3AndWidth4&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="c1"&gt;// Output: 60&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;curriedVolume&lt;/code&gt; is a function that takes &lt;code&gt;length&lt;/code&gt; and returns another function that takes &lt;code&gt;width&lt;/code&gt;, which in turn returns another function that takes &lt;code&gt;height&lt;/code&gt; and finally returns the volume.&lt;/p&gt;

&lt;h3&gt;
  
  
  Example 2: Real-World Example with Logger Function
&lt;/h3&gt;

&lt;p&gt;Let's consider a logging function that logs messages with different log levels and timestamps:&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;logMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;level&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] [&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;level&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;]: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="nf"&gt;logMessage&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;INFO&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="s1"&gt;User logged in successfully.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now, let's curry this function to create more specific logging functions:&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;curriedLog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;timestamp&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="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;level&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="nf"&gt;function &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`[&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;timestamp&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;] [&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;level&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;]: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;message&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;};&lt;/span&gt;
  &lt;span class="p"&gt;};&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c1"&gt;// Usage&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logToday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;curriedLog&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;Date&lt;/span&gt;&lt;span class="p"&gt;());&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;logInfoToday&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;logToday&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;INFO&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="nf"&gt;logInfoToday&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;User logged in successfully.&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;With currying, we created specific logging functions for different log levels, enhancing code reusability and readability.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Currying is a powerful technique in functional programming that can make your JavaScript code more modular, reusable, and expressive. By transforming functions to accept arguments one at a time, you open up new possibilities for partial application and function composition.&lt;/p&gt;

&lt;p&gt;Give currying a try in your next project and see how it can simplify your codebase. Happy coding! 🎉&lt;/p&gt;

&lt;p&gt;Feel free to leave your thoughts, questions, or examples of currying in the comments below. Let's learn together!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>CPU vs GPU: Understanding the Difference in Simple Terms</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Wed, 01 May 2024 06:50:53 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/cpu-vs-gpu-understanding-the-difference-in-simple-terms-3mdl</link>
      <guid>https://dev.to/elizabethsobiya/cpu-vs-gpu-understanding-the-difference-in-simple-terms-3mdl</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction:&lt;/strong&gt;&lt;br&gt;
When it comes to computers, you might have heard about two important components: the CPU and the GPU. But what exactly are they, and how do they differ? In this article, we'll break down the differences between the CPU and GPU in simple terms that anyone can understand.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. What is a CPU?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The CPU, or Central Processing Unit, is like the brain of a computer. It handles tasks such as running programs, performing calculations, and managing data. Think of it as the command center that controls everything your computer does.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;2. What is a GPU?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The GPU, or Graphics Processing Unit, is a specialized processor designed to handle graphics-related tasks. It's responsible for rendering images, videos, and animations on your screen. Unlike the CPU, which is more general-purpose, the GPU is optimized for parallel processing, making it ideal for graphics-intensive applications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;3. How do they differ?&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The main difference between the CPU and GPU lies in their architecture and function. 

&lt;ul&gt;
&lt;li&gt;CPU: The CPU typically has fewer cores (processing units) but higher clock speeds. It excels at sequential tasks that require a lot of processing power, such as running software applications and multitasking.&lt;/li&gt;
&lt;li&gt;GPU: The GPU, on the other hand, has thousands of smaller cores optimized for parallel processing. While each core may not be as powerful as a CPU core, they work together to handle tasks simultaneously, making the GPU ideal for tasks like gaming, video editing, and 3D rendering.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;4. Analogies to Understand:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;CPU: Think of the CPU as the manager of a company. It's responsible for making decisions, delegating tasks, and ensuring everything runs smoothly. &lt;/li&gt;
&lt;li&gt;GPU: Imagine the GPU as a team of workers in a factory, each specialized in a specific task. Together, they can produce goods much faster than a single worker could on their own.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. When to Use Each:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the CPU for general-purpose computing tasks like browsing the web, word processing, and running everyday applications.&lt;/li&gt;
&lt;li&gt;Use the GPU for tasks that require heavy graphical processing, such as gaming, video editing, 3D modeling, and machine learning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;br&gt;
In summary, the CPU and GPU are both essential components of a computer, each serving a different purpose. While the CPU acts as the brain, handling general computing tasks, the GPU specializes in graphics-related tasks, thanks to its parallel processing capabilities. Understanding the difference between the two can help you make informed decisions when building or upgrading your system.&lt;/p&gt;

</description>
      <category>computerscience</category>
      <category>gpu</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Let's Dive into the World of Web Sockets: A Beginner's Guide</title>
      <dc:creator>Elizabeth Sobiya</dc:creator>
      <pubDate>Thu, 25 Apr 2024 06:38:23 +0000</pubDate>
      <link>https://dev.to/elizabethsobiya/lets-dive-into-the-world-of-web-sockets-a-beginners-guide-f2c</link>
      <guid>https://dev.to/elizabethsobiya/lets-dive-into-the-world-of-web-sockets-a-beginners-guide-f2c</guid>
      <description>&lt;p&gt;Hey there, fellow devs! Today, we're going to dive into an exciting journey into the world of web sockets. 🚀 Have you ever wondered how real-time communication between your browser and a server happens? Well, that's where web sockets come into play!&lt;/p&gt;

&lt;h3&gt;
  
  
  What are Web Sockets?
&lt;/h3&gt;

&lt;p&gt;Think of web sockets as a two-way communication channel between a client (your browser) and a server. Unlike traditional HTTP requests, which are unidirectional (client sends a request, server responds), web sockets allow for full-duplex communication, meaning both the client and the server can send messages to each other simultaneously.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why Do We Need Web Sockets?
&lt;/h3&gt;

&lt;p&gt;Imagine you're building a chat application, and you want messages to appear instantly for all users without needing to refresh the page. Or perhaps you're working on a real-time multiplayer game where players need to see each other's moves in real-time. This is where web sockets shine! They provide a low-latency, high-performance solution for real-time communication.&lt;/p&gt;

&lt;h3&gt;
  
  
  How Do Web Sockets Work?
&lt;/h3&gt;

&lt;p&gt;Okay, let's break it down into simple steps:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Opening the Connection&lt;/strong&gt;: First, the client (browser) initiates a connection to the server by sending a special HTTP request called a WebSocket handshake request.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Establishing the Connection&lt;/strong&gt;: Once the server receives the handshake request, it responds with a WebSocket handshake response, indicating that the connection has been established.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Bi-Directional Communication&lt;/strong&gt;: Now that the connection is open, both the client and the server can send messages to each other whenever they want, without the overhead of HTTP headers.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Closing the Connection&lt;/strong&gt;: When either the client or the server decides to terminate the connection, they can send a close message, and the connection will be gracefully closed.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Hands-On Example: Let's Build a Real-Time Chat App!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To help solidify our understanding, let's build a simple real-time chat application using web sockets. Here's what we'll need:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Frontend: HTML, CSS, JavaScript (or your favorite frontend framework like React)&lt;/li&gt;
&lt;li&gt;Backend: Node.js (or any server-side technology of your choice)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We'll set up a WebSocket server on the backend and create a client-side application that connects to the server and sends/receives messages in real-time. Along the way, we'll learn about handling WebSocket events, broadcasting messages to multiple clients, and more!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;And there you have it, folks! We've scratched the surface of web sockets and explored their incredible capabilities for real-time communication on the web. From chat applications to multiplayer games, web sockets open up a world of possibilities for building interactive, engaging web experiences. So, what are you waiting for? Start experimenting with web sockets in your projects and see where they take you!&lt;/p&gt;

&lt;p&gt;Happy coding! 🎉&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>socket</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
