<?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: Clara Situma</title>
    <description>The latest articles on DEV Community by Clara Situma (@csituma).</description>
    <link>https://dev.to/csituma</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%2F475039%2F90afc0b8-8ac5-4de9-90eb-6a32bbb8cc51.jpeg</url>
      <title>DEV Community: Clara Situma</title>
      <link>https://dev.to/csituma</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/csituma"/>
    <language>en</language>
    <item>
      <title>We Are Training Conversational AI Wrong!</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Tue, 27 Jan 2026 13:44:29 +0000</pubDate>
      <link>https://dev.to/csituma/we-are-training-conversational-ai-wrong-b06</link>
      <guid>https://dev.to/csituma/we-are-training-conversational-ai-wrong-b06</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Make it more human!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Make it shorter and less fluff.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Sound more relatable.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;These are instructions AI models hear constantly from real users interacting with systems like ChatGPT. The irony is striking: AI has already been trained on billions of words of human language. It understands grammar, sentence structure, social norms, and communication patterns.&lt;/p&gt;

&lt;p&gt;So why do users still have to tell AI to "sound human"?&lt;/p&gt;

&lt;p&gt;Because we are training it on the wrong kind of human language! &lt;code&gt;Current AI training prioritizes polished, edited, formal text over the messy, emotional, context-rich way humans actually talk. The gap is not in language understanding but in conversational authenticity.&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  The Training Data Problem
&lt;/h2&gt;

&lt;p&gt;Most large language models are trained on three main sources: &lt;strong&gt;web text, books, and curated dialogue datasets&lt;/strong&gt;. These sources share a critical flaw: _they favor finished, edited communication over natural conversation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Web text&lt;/strong&gt; includes articles, blog posts, and forum discussions that have been revised and polished before publication. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Books&lt;/strong&gt; represent carefully crafted prose that has gone through multiple drafts and editorial review. &lt;/p&gt;

&lt;p&gt;Even &lt;strong&gt;dialogue datasets&lt;/strong&gt; are often synthetic conversations created specifically for training, or transcripts that have been cleaned and standardized.&lt;/p&gt;

&lt;p&gt;Real human conversation looks nothing like this. We use filler words, change direction mid-thought, interrupt ourselves, employ regional slang, and constantly check for understanding. We use, "like," and "you know." We ask, "Does that make sense?" or "Am I explaining this clearly?" These elements are systematically filtered out of training data because they look like noise.&lt;/p&gt;

&lt;h2&gt;
  
  
  The RLHF Mismatch
&lt;/h2&gt;

&lt;p&gt;Reinforcement Learning from Human Feedback compounds this problem. &lt;code&gt;RLHF evaluators typically reward responses that are clear, structured, grammatically perfect, and complete.&lt;/code&gt; They penalize rambling, hedging, or conversational meandering.&lt;/p&gt;

&lt;p&gt;Critically, RLHF rewards structure and correctness, not pauses, hedges, or meta conversational checks, which are essential for natural dialogue. A response that says "Wait, are you asking about X or Y?" scores lower than one that immediately provides a complete answer, even when clarification would better serve the user.&lt;/p&gt;

&lt;p&gt;The signal AI receives is clear: be more like an essay, less like a conversation. The result is &lt;strong&gt;AI that excels at formal communication but struggles with the informal, relational mode&lt;/strong&gt; that users actually want for everyday interaction.&lt;/p&gt;

&lt;h2&gt;
  
  
  Formal Tasks versus Conversational Tasks
&lt;/h2&gt;

&lt;p&gt;This training approach works well for certain use cases. When users need legal writing, code generation, or research summarization, they want precision and structure. AI trained on polished text performs excellently here.&lt;/p&gt;

&lt;p&gt;But conversational AI serves different purposes. &lt;code&gt;Users turn to it for brainstorming, emotional support, casual exploration of ideas, or simply companionship. These contexts require relational awareness, empathy, appropriate pacing, and the ability to read between the lines.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Current training does not distinguish between these modes.&lt;code&gt;The same model, trained on the same data with the same reward signals, is expected to write a legal brief and also chat like a friend. It can do the former naturally but must be explicitly prompted to attempt the latter.&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  What Gets Lost in Translation
&lt;/h2&gt;

&lt;p&gt;By 2025, Gartner predicted that seventy percent of customer interactions will involve AI in some form. As conversational AI becomes ubiquitous, the gap between technical accuracy and conversational effectiveness becomes increasingly critical.&lt;/p&gt;

&lt;p&gt;Meta conversational moves are essential to natural dialogue. &lt;code&gt;Studies show that twenty to twenty-five percent of human utterances involve clarification, verification, or relationship management (Clark and Schaefer, 1989).&lt;/code&gt; We say things like "Is this what you mean?" or "Do you want my advice or just someone to listen?" AI rarely initiates these moves because doing so was not rewarded during training.&lt;/p&gt;

&lt;p&gt;Emotional context recognition matters more than we acknowledge. When someone asks about a school closure, they are not just seeking dates and logistics. They may be worried about childcare, concerned about their child's education, or relieved to have a break. Human conversation naturally acknowledges this subtext. AI trained on factual accuracy alone misses it entirely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider this real-world interaction with ChatGPT:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt; &lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;"I am really stressed about my kid’s school."&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ChatGPT Response:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It sounds like you’re carrying a lot of worry right now. School can be stressful for both kids and parents, and it’s completely normal to feel overwhelmed. Sometimes just talking about what’s specifically worrying you like grades, social issues, or the workload, can help make it feel more manageable. If you want, I can help you break it down and come up with a few ways to reduce that stress for both you and your child. Do you want to do that?"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Human Response:
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;"Why? What happened?"&lt;/p&gt;

&lt;p&gt;The AI response is &lt;strong&gt;technically correct, empathetic,&lt;/strong&gt; and structured, but it is&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;long&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;cautious&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;informational&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;whereas a human naturally seeks immediate clarification and context. This highlights the gap: AI has empathy coded in, but it lacks conversational spontaneity and prioritization of relational signals.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conversational Pacing, Rhythm, and Diversity
&lt;/h2&gt;

&lt;p&gt;Conversational pacing and rhythm shape how we interpret meaning. Nielsen Norman Group research shows that people read only twenty to twenty-eight percent of words on a web page, relying heavily on context, formatting, and pacing to extract meaning. In conversation, we use similar shortcuts: pauses, tone shifts, topic transitions. AI optimized for information density without regard for pacing feels overwhelming or robotic.&lt;/p&gt;

&lt;p&gt;Regional, generational, and cultural variation in language use is vast. The way a teenager in California talks differs dramatically from how a retiree in Georgia talks, which differs from how a professional in London talks. Training data that over represents formal, standard English creates AI that sounds generic and disconnected from real human diversity.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Evaluation Problem
&lt;/h2&gt;

&lt;p&gt;Why does AI training miss these critical conversational elements? Part of the answer lies in how we measure success.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Current benchmarks for conversational AI focus on factual correctness, BLEU or ROUGE scores for text similarity, and grammaticality.&lt;/code&gt; Few metrics capture empathy, relational alignment, or conversational pacing. What gets measured gets optimized, and conversational quality is rarely measured in ways that matter for human connection.&lt;/p&gt;

&lt;h2&gt;
  
  
  Evidence from Real World Applications
&lt;/h2&gt;

&lt;h2&gt;
  
  
  Customer Support
&lt;/h2&gt;

&lt;p&gt;A 2023 Zendesk survey found that&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sixty-nine percent of consumers still prefer human agents for complex or emotionally charged issues.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Chatbots fully resolve only twenty-nine percent of inquiries without human escalation. The most common complaint is not inaccuracy but tone:&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;The bot answered my question but it felt like no one was listening.&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Customer support is fundamentally relational. People want to feel heard, not just helped. AI trained to maximize answer accuracy without emotional awareness cannot deliver this experience.&lt;/p&gt;

&lt;h2&gt;
  
  
  Mental Health Applications
&lt;/h2&gt;

&lt;p&gt;AI companions like Woebot and Wysa demonstrate what happens when conversational AI is trained with relational skills in mind. &lt;code&gt;These systems show measurable improvements in user anxiety and depression scores, not because they are more accurate than general AI, but because they employ empathy, ask clarifying questions, and pace their responses appropriately&lt;/code&gt; (Fitzpatrick et al., 2017; Inkster et al., 2018).&lt;/p&gt;

&lt;p&gt;The contrast is telling. When AI is deliberately trained to mirror human conversational strategies, it performs better in human contexts. The problem is not AI capability but training focus.&lt;/p&gt;

&lt;h2&gt;
  
  
  Personal Assistance
&lt;/h2&gt;

&lt;p&gt;Users interacting with AI assistants frequently report frustration with tone and appropriateness even when factual responses are correct. A technically accurate answer delivered without awareness of context, urgency, or emotional state feels unhelpful. Users compensate by adding instructions like "be casual," "be brief," or "explain like I am five," essentially trying to manually correct for training deficiencies.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Conversational AI Actually Needs
&lt;/h2&gt;

&lt;p&gt;To train AI for genuine conversational fluency, we need fundamental changes in approach:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Different training data sources&lt;/strong&gt;. &lt;code&gt;Include unedited text messages, voice transcripts, casual social media threads, and real spoken conversation. Preserve filler words, false starts, topic shifts, and informal phrasing.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Annotation for relational context&lt;/strong&gt;. Tag examples for emotional tone, relationship dynamics, conversational intent, and appropriateness. Teach AI to recognize when someone is venting, seeking advice, or needs levity versus seriousness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reward signals beyond correctness&lt;/strong&gt;. RLHF should evaluate empathy, trust building, conversational awareness, and relational appropriateness alongside clarity and accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cultural and demographic diversity&lt;/strong&gt;. Training should include regional, generational, professional, and cultural variations to prevent generic or disconnected responses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Explicit training on conversational strategies&lt;/strong&gt;. Teach AI to employ clarification questions, meta conversational checks, pauses, and tone matching. These are learnable patterns that currently go untrained.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Path Forward
&lt;/h2&gt;

&lt;p&gt;Friendly conversational AI is not failing because it lacks language understanding.&lt;code&gt;It is failing because it was trained in contexts that prioritize polish over authenticity, correctness over connection, and structure over spontaneity.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Formal AI tasks can tolerate this approach. Legal writing and code generation do not require empathy or relational awareness. Conversational AI cannot succeed without them.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;The solution requires treating conversational fluency as a distinct skill requiring distinct training&lt;/code&gt;. We must train AI on how humans actually talk, not just how they write for publication. We must reward relational awareness, emotional intelligence, and conversational strategies, not just accuracy and clarity.&lt;/p&gt;

&lt;p&gt;Until we do this, users will continue telling AI to "be more human" while it produces responses that are technically correct but emotionally flat, grammatically perfect but conversationally awkward, informationally complete but relationally empty.&lt;/p&gt;

&lt;p&gt;We already have the language. We just need to teach AI the conversation.&lt;/p&gt;

&lt;h2&gt;
  
  
  References
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="nx"&gt;Clark&lt;/span&gt; &lt;span class="nx"&gt;HH&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Schaefer&lt;/span&gt; &lt;span class="nx"&gt;EF&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Contributing&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Discourse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Cognitive&lt;/span&gt; &lt;span class="nx"&gt;Science&lt;/span&gt; &lt;span class="mi"&gt;1989&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="mi"&gt;13&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;259&lt;/span&gt;&lt;span class="err"&gt;–&lt;/span&gt;&lt;span class="mi"&gt;294&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Fitzpatrick&lt;/span&gt; &lt;span class="nx"&gt;KK&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Darcy&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Vierhile&lt;/span&gt; &lt;span class="nx"&gt;M&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Delivering&lt;/span&gt; &lt;span class="nx"&gt;Cognitive&lt;/span&gt; &lt;span class="nx"&gt;Behavior&lt;/span&gt; &lt;span class="nx"&gt;Therapy&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;Young&lt;/span&gt; &lt;span class="nx"&gt;Adults&lt;/span&gt; &lt;span class="nx"&gt;With&lt;/span&gt; &lt;span class="nx"&gt;Symptoms&lt;/span&gt; &lt;span class="k"&gt;of&lt;/span&gt; &lt;span class="nx"&gt;Depression&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;Anxiety&lt;/span&gt; &lt;span class="nx"&gt;Using&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;Fully&lt;/span&gt; &lt;span class="nx"&gt;Automated&lt;/span&gt; &lt;span class="nx"&gt;Conversational&lt;/span&gt; &lt;span class="nx"&gt;Agent&lt;/span&gt; &lt;span class="nx"&gt;Woebot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;A&lt;/span&gt; &lt;span class="nx"&gt;Randomized&lt;/span&gt; &lt;span class="nx"&gt;Controlled&lt;/span&gt; &lt;span class="nx"&gt;Trial&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;JMIR&lt;/span&gt; &lt;span class="nx"&gt;Mental&lt;/span&gt; &lt;span class="nx"&gt;Health&lt;/span&gt; &lt;span class="mi"&gt;2017&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;&lt;span class="nx"&gt;e19&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Gartner&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Top&lt;/span&gt; &lt;span class="nx"&gt;Strategic&lt;/span&gt; &lt;span class="nx"&gt;Technology&lt;/span&gt; &lt;span class="nx"&gt;Trends&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="mi"&gt;2022&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;AI&lt;/span&gt; &lt;span class="nx"&gt;Engineering&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="mi"&gt;2021&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Inkster&lt;/span&gt; &lt;span class="nx"&gt;B&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Sarda&lt;/span&gt; &lt;span class="nx"&gt;S&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;Subramanian&lt;/span&gt; &lt;span class="nx"&gt;V&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;An&lt;/span&gt; &lt;span class="nx"&gt;Empathy&lt;/span&gt; &lt;span class="nx"&gt;Driven&lt;/span&gt; &lt;span class="nx"&gt;Conversational&lt;/span&gt; &lt;span class="nx"&gt;Agent&lt;/span&gt; &lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="nx"&gt;Mental&lt;/span&gt; &lt;span class="nx"&gt;Health&lt;/span&gt; &lt;span class="nx"&gt;Applications&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Frontiers&lt;/span&gt; &lt;span class="k"&gt;in&lt;/span&gt; &lt;span class="nx"&gt;Psychiatry&lt;/span&gt; &lt;span class="mi"&gt;2018&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="mi"&gt;9&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="err"&gt;–&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Nielsen&lt;/span&gt; &lt;span class="nx"&gt;Norman&lt;/span&gt; &lt;span class="nx"&gt;Group&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;How&lt;/span&gt; &lt;span class="nx"&gt;Users&lt;/span&gt; &lt;span class="nx"&gt;Read&lt;/span&gt; &lt;span class="nx"&gt;on&lt;/span&gt; &lt;span class="nx"&gt;the&lt;/span&gt; &lt;span class="nx"&gt;Web&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="mi"&gt;2021&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;

&lt;span class="nx"&gt;Zendesk&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="nx"&gt;Customer&lt;/span&gt; &lt;span class="nx"&gt;Experience&lt;/span&gt; &lt;span class="nx"&gt;Trends&lt;/span&gt; &lt;span class="nx"&gt;Report&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt; &lt;span class="mi"&gt;2023&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>llm</category>
      <category>ai</category>
      <category>softwareengineering</category>
    </item>
    <item>
      <title>USING VITE?, Upgrade to tailwindcss..version 4</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Tue, 10 Jun 2025 10:16:24 +0000</pubDate>
      <link>https://dev.to/csituma/using-vite-upgrade-to-tailiwindcss4-1c61</link>
      <guid>https://dev.to/csituma/using-vite-upgrade-to-tailiwindcss4-1c61</guid>
      <description>&lt;p&gt;&lt;strong&gt;Tailwind v3 (and earlier)&lt;/strong&gt;: The documented integration is via PostCSS. You install tailwindcss, postcss, and autoprefixer, create a postcss.config.js, and a tailwind.config.js.....&lt;/p&gt;

&lt;p&gt;Sooo much WORK,IKR?&lt;/p&gt;

&lt;p&gt;THEN &lt;/p&gt;

&lt;p&gt;import your CSS containing&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;base&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;components&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;@tailwind&lt;/span&gt; &lt;span class="n"&gt;utilities&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Vite’s dev and build steps then process Tailwind automatically. This is the stable method for Tailwind v3 projects &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;WHAT CHANGED&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Tailwind v4 and later&lt;/strong&gt;: Tailwind v4 introduced a &lt;strong&gt;&lt;em&gt;first-party Vite plugin (&lt;a class="mentioned-user" href="https://dev.to/tailwindcss"&gt;@tailwindcss&lt;/a&gt;/vite)&lt;/em&gt;&lt;/strong&gt; for even faster builds and “zero config” content detection.&lt;/p&gt;

&lt;p&gt;If you upgrade to Tailwind v4, you ONLY install both tailwindcss (v4) and &lt;a class="mentioned-user" href="https://dev.to/tailwindcss"&gt;@tailwindcss&lt;/a&gt;/vite.No taliwind.config.js ....not postcss.config.js..... JUST ADD to your vite.config.js, tailwindcss() to plugins.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;defineConfig&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;react&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@vitejs/plugin-react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;tailwindcss&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;@tailwindcss/vite&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// https://vite.dev/config/&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nf"&gt;defineConfig&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
  &lt;span class="na"&gt;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nf"&gt;react&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="nf"&gt;tailwindcss&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;Under the hood this still processes via PostCSS-like logic but with extra optimizations and automatic content scanning, so you don’t need manual content globs unless you have special cases.&lt;/p&gt;

&lt;p&gt;and on your global css&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s1"&gt;"tailwindcss"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;That's it!&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>hoisting</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Mon, 30 Dec 2024 09:27:17 +0000</pubDate>
      <link>https://dev.to/csituma/hoisting-3fn6</link>
      <guid>https://dev.to/csituma/hoisting-3fn6</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/csituma" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F475039%2F90afc0b8-8ac5-4de9-90eb-6a32bbb8cc51.jpeg" alt="csituma"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/csituma/hoisting-in-js-reference-error-12no" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;HOISTING IN JS (REFERENCE ERROR!!)&lt;/h2&gt;
      &lt;h3&gt;Clara Situma ・ Dec 30 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#react&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#beginners&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>webdev</category>
      <category>react</category>
    </item>
    <item>
      <title>HOISTING IN JS (REFERENCE ERROR!!)</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Mon, 30 Dec 2024 07:37:44 +0000</pubDate>
      <link>https://dev.to/csituma/hoisting-in-js-reference-error-12no</link>
      <guid>https://dev.to/csituma/hoisting-in-js-reference-error-12no</guid>
      <description>&lt;p&gt;&lt;strong&gt;Understanding Hoisting in JavaScript&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hoisting is one of the most fundamental concepts in JavaScript, yet it can be a source of confusion for beginners and even seasoned developers.&lt;/p&gt;

&lt;p&gt;In this blog, we will demystify hoisting, explain how it works, and provide clear examples to help you fully understand this concept.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is Hoisting?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hoisting is a JavaScript mechanism where &lt;strong&gt;&lt;em&gt;declarations of variables, functions, and classes&lt;/em&gt;&lt;/strong&gt; are &lt;strong&gt;moved to the top of their scope during the compilation phase&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;This means you can use these elements before they are actually declared in the code. &lt;/p&gt;

&lt;p&gt;However, hoisting works differently for var, let, const, functions, and classes, and this is where confusion often arises&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How Hoisting Works&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When JavaScript code is executed, it goes through two phases:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Compilation Phase&lt;/em&gt;&lt;/strong&gt;: During this phase, the engine hoists declarations to the top of their scope.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;Execution Phase&lt;/em&gt;&lt;/strong&gt;: The code runs line by line, respecting the rules of hoisting.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Hoisting Rules for Different Declarations&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. var&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Variables declared with var are hoisted, but their value is not initialized. Before the initialization, &lt;strong&gt;they are set to undefined.&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;
&lt;span class="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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: undefined&lt;/span&gt;
&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;10&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;a&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Output: 10&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;let and const&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Variables declared with let and const are also hoisted but remain in the &lt;strong&gt;Temporal Dead Zone (TDZ)&lt;/strong&gt;. They cannot be accessed until their declaration is encountered in the code.&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;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;b&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError: Cannot access 'b' before initialization&lt;/span&gt;
&lt;span class="kd"&gt;let&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;20&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&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;c&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError: Cannot access 'c' before initialization&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;c&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt;Functions&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Function declarations are fully hoisted, meaning both their name and body are moved to the top. This allows you to call functions before they are declared.&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="nf"&gt;greet&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// Output: "Hello, World!"&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;greet&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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&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;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, function expressions are treated differently. They behave like variables declared with var, let, or const:&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="nf"&gt;sayHi&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError: Cannot access 'sayHi' before initialization&lt;/span&gt;

&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sayHi&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;function &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="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hi!&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;ol&gt;
&lt;li&gt;Classes&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Classes are hoisted but remain in the &lt;strong&gt;Temporal Dead Zone&lt;/strong&gt;, similar to let and const. You cannot access a class before it is declared.&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;obj&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// ReferenceError: Cannot access 'MyClass' before initialization&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;MyClass&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nf"&gt;constructor&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;name&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Class&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Understanding the Temporal Dead Zone (TDZ)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The Temporal Dead Zone is the period between the start of the scope and the point where the variable is declared. During this period, any access to let or const variables will throw a ReferenceError.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="nc"&gt;Key&lt;/span&gt; &lt;span class="nc"&gt;Takeaways&lt;/span&gt;

&lt;span class="nc"&gt;Declaration&lt;/span&gt;   &lt;span class="nc"&gt;Hoisted&lt;/span&gt;&lt;span class="o"&gt;?&lt;/span&gt;       &lt;span class="nc"&gt;Behavior&lt;/span&gt; &lt;span class="nc"&gt;Before&lt;/span&gt; &lt;span class="nc"&gt;Initialization&lt;/span&gt;

&lt;span class="k"&gt;var&lt;/span&gt;            &lt;span class="nc"&gt;Yes&lt;/span&gt;              &lt;span class="n"&gt;undefined&lt;/span&gt;

&lt;span class="n"&gt;let&lt;/span&gt;            &lt;span class="nc"&gt;Yes&lt;/span&gt;            &lt;span class="nf"&gt;ReferenceError&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="no"&gt;TDZ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;const&lt;/span&gt;          &lt;span class="no"&gt;Yes&lt;/span&gt;             &lt;span class="no"&gt;ReferenceError&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="no"&gt;TDZ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="n"&gt;Declaration&lt;/span&gt;  &lt;span class="n"&gt;Yes&lt;/span&gt;       &lt;span class="n"&gt;Fully&lt;/span&gt; &lt;span class="n"&gt;hoisted&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kt"&gt;works&lt;/span&gt; &lt;span class="n"&gt;before&lt;/span&gt; 
&lt;span class="n"&gt;declaration&lt;/span&gt;

&lt;span class="k"&gt;Function&lt;/span&gt; &lt;span class="n"&gt;Expression&lt;/span&gt;  &lt;span class="n"&gt;Partially&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;as&lt;/span&gt; &lt;span class="k"&gt;var&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;   &lt;span class="kt"&gt;undefined&lt;/span&gt; &lt;span class="k"&gt;or&lt;/span&gt; &lt;span class="nf"&gt;ReferenceError&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="n"&gt;let&lt;/span&gt;&lt;span class="o"&gt;/&lt;/span&gt;&lt;span class="k"&gt;const&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nc"&gt;Class&lt;/span&gt;           &lt;span class="nc"&gt;Yes&lt;/span&gt;              &lt;span class="nf"&gt;ReferenceError&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;in&lt;/span&gt; &lt;span class="no"&gt;TDZ&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;Understanding hoisting is critical for writing clean and predictable JavaScript code. While it may seem like magic at first, knowing the rules for var, let, const, functions, and classes will help you avoid common pitfalls. Always declare your variables and functions at the top of their scope to ensure clarity and reduce the chances of errors.&lt;/p&gt;

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

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Export .env Quick and Easy</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Sat, 07 Dec 2024 15:17:45 +0000</pubDate>
      <link>https://dev.to/csituma/export-env-quick-and-easy-651</link>
      <guid>https://dev.to/csituma/export-env-quick-and-easy-651</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/csituma" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F475039%2F90afc0b8-8ac5-4de9-90eb-6a32bbb8cc51.jpeg" alt="csituma"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/csituma/how-do-you-export-env-from-vercel-new-laptop-old-project-no-problem-1fd1" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Export .env from Vercel: New Laptop, Old Project? No Problem!&lt;/h2&gt;
      &lt;h3&gt;Clara Situma ・ Dec 7 '24&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#vercel&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#webdev&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#nextjs&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
    </item>
    <item>
      <title>Export .env from Vercel: New Laptop, Old Project? No Problem!</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Sat, 07 Dec 2024 13:09:30 +0000</pubDate>
      <link>https://dev.to/csituma/how-do-you-export-env-from-vercel-new-laptop-old-project-no-problem-1fd1</link>
      <guid>https://dev.to/csituma/how-do-you-export-env-from-vercel-new-laptop-old-project-no-problem-1fd1</guid>
      <description>&lt;p&gt;Starting fresh on a new laptop or revisiting an old project doesn’t mean you’re stuck hunting for missing keys. &lt;/p&gt;

&lt;p&gt;With Vercel, pulling down your environment variables is a breeze. Let’s dive in and get your project up and running in no time!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Exporting .env from Vercel&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Here’s how you can seamlessly retrieve your .env file from Vercel:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Install the Vercel CLI&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before you start, make sure the &lt;strong&gt;Vercel CLI&lt;/strong&gt; is installed globally on your system. If not, install it via npm:&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;npm&lt;/span&gt; &lt;span class="nx"&gt;install&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;g&lt;/span&gt; &lt;span class="nx"&gt;vercel&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 2: Link Your Local Project&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Navigate to the root directory of your project and run the following command:&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;vercel&lt;/span&gt; &lt;span class="nx"&gt;link&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;Follow the prompts to select your account (personal or team) and link to the existing Vercel project.&lt;/p&gt;

&lt;p&gt;If you’re linking to a specific project (e.g., buyrentzanzibarclient), the CLI will list it—simply select it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Pull the .env File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once linked, pull down your environment variables directly into a local .env file:&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;vercel&lt;/span&gt; &lt;span class="nx"&gt;env&lt;/span&gt; &lt;span class="nx"&gt;pull&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;This creates a .env file in your project’s root directory, pre-filled with all the environment variables set in the Vercel dashboard.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Verify the .env File&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Open the .env file to ensure everything is in place. It should look something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="no"&gt;API_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;api&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;example&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;com&lt;/span&gt;
&lt;span class="no"&gt;DATABASE_URL&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;database&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;url&lt;/span&gt;
&lt;span class="no"&gt;SECRET_KEY&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;secret&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;key&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;&lt;strong&gt;Pro Tip: Secure Your .env File&lt;/strong&gt;&lt;/em&gt;&lt;br&gt;
Once you’ve exported your .env file, add it to your .gitignore to prevent it from being pushed to your repository&lt;/p&gt;

</description>
      <category>vercel</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>5 Vercel Features Developers Absolutely Love</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Wed, 20 Nov 2024 19:42:39 +0000</pubDate>
      <link>https://dev.to/csituma/5-vercel-features-developers-absolutely-love-5850</link>
      <guid>https://dev.to/csituma/5-vercel-features-developers-absolutely-love-5850</guid>
      <description>&lt;p&gt;Vercel has been a game-changer for developers, redefining how we approach web development with tools that make our lives easier, faster, and more collaborative. Here are the top five features developers can’t stop raving about&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;1. Edge Middleware: Smarter, Faster&lt;/strong&gt; 🦸‍♂️
&lt;/h2&gt;

&lt;p&gt;Edge Middleware allows you to intercept and modify requests at the edge, delivering faster responses and highly personalized experiences. Think of it as a smart traffic controller for your web app.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why We Love It:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Blazing Speed&lt;/strong&gt;: Processes requests close to the user, reducing latency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Full Control&lt;/strong&gt;: Customize routing, security, and content delivery effortlessly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Flexibility&lt;/strong&gt;:  Merge edge performance with dynamic content without hassle.nt with edge performance seamlessly.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Real-Life Impact: Region-Specific Content&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Serving region-specific content is a breeze. For example, US visitors can see a tailored homepage, while European users are seamlessly directed to their own-all with minimal overhead.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code Example: Redirect Based on Location&lt;/strong&gt;
&lt;/h3&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;NextResponse&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;next/server&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;middleware&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&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;country&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;geo&lt;/span&gt;&lt;span class="p"&gt;?.&lt;/span&gt;&lt;span class="nx"&gt;country&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c1"&gt;// Access geolocation data&lt;/span&gt;

  &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;country&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;US&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;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rewrite&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;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/us-homepage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="k"&gt;if &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;country&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;DE&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;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rewrite&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;URL&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;/de-homepage&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;NextResponse&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;next&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt; &lt;span class="c1"&gt;// proceed if no conditions are met&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  &lt;strong&gt;2. Preview Deployments: Collaboration Made Easy&lt;/strong&gt; 🤝
&lt;/h2&gt;

&lt;p&gt;Vercel’s Preview Deployments make team collaboration effortless. Every pull request automatically gets its own live preview URL, ensuring everyone is on the same page—literally.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why We Love It:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instant Visibility&lt;/strong&gt;: No setup required—preview links are generated automatically.
-&lt;strong&gt;Streamlined Feedback&lt;/strong&gt;: Share live previews with teammates, clients, or stakeholders.
-&lt;strong&gt;Fewer Misunderstandings&lt;/strong&gt;: Everyone can see proposed changes in real-time.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Real-Life Impact:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;UI Reviews&lt;/strong&gt;: Designers and developers can work together to finalize designs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;QA Testing&lt;/strong&gt;: Share a live link for testers to check functionality and report bugs.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Client Demos&lt;/strong&gt;: Show clients live progress without setting up a staging environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How It Works:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Push changes to a branch in GitHub, GitLab, or Bitbucket.&lt;/li&gt;
&lt;li&gt;Open a pull request.&lt;/li&gt;
&lt;li&gt;Vercel automatically generates a unique preview URL:
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;https&lt;/span&gt;&lt;span class="o"&gt;://&lt;/span&gt;&lt;span class="n"&gt;branch&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;name&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;your&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="n"&gt;project&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;vercel&lt;/span&gt;&lt;span class="mf"&gt;.&lt;/span&gt;&lt;span class="n"&gt;app&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Teams save hours on back-and-forth communication with this feature alone.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;3.Global Edge Network: Performance Without Boundaries 🌍&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Vercel’s Global Edge Network ensures your app’s content is served from the edge location nearest to your user. This guarantees lightning-fast performance, no matter where in the world your audience is located.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why We Love It:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Easily handle massive traffic surges during launches or sales.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Reduced Latency&lt;/strong&gt;: Faster load times by serving content closer to the user.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;High Reliability&lt;/strong&gt;: Redundant edge locations keep your app online, even during failures.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Real-Life Impact:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For a global e-commerce store, customers in Asia, Europe, and the Americas will enjoy the same snappy experience because content is cached and served from the closest edge location.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code Example: ISR with Global Edge Caching&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;async&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;getStaticProps&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Fetch data from an API or database&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="nf"&gt;fetch&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://api.example.com/data&lt;/span&gt;&lt;span class="dl"&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;res&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;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="na"&gt;props&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;data&lt;/span&gt; &lt;span class="p"&gt;},&lt;/span&gt;
    &lt;span class="na"&gt;revalidate&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;// Regenerate the page every 60 seconds&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;This example combines Instant Static Regeneration (ISR) with edge caching, ensuring users get fresh data quickly, without hitting your backend every time.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;4. Intelligent Caching: Smarter Performance Boosts 🧠&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Caching is critical for web performance, and Vercel takes it to the next level with intelligent caching. This feature gives you fine-grained control over what gets cached, for how long, and how updates are handled—all while seamlessly integrating with the edge network.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why We Love It:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Customizable&lt;/strong&gt;: Tailor caching rules for specific pages or assets.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Efficient&lt;/strong&gt;: Cut server load and boost user experience.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Dynamic Updates&lt;/strong&gt;: ISR keeps content fresh while maintaining speed..&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Real-Life Impact:&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;For a high-traffic news site, you can cache API responses and regenerate pages every 60 seconds, ensuring users get the latest updates without overloading your backend.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Code Example: Setting Cache-Control Headers&lt;/strong&gt;
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;handler&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;req&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// Define caching rules&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;setHeader&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Cache-Control&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;public, max-age=3600, stale-while-revalidate=59&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="c1"&gt;// Respond with JSON data&lt;/span&gt;
  &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="na"&gt;message&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;This response is cached!&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;p&gt;Intelligent caching ensures your app stays fast and reliable, even as traffic grows. It’s the perfect balance between performance and flexibility, making it a must-have for any modern web project. ⚡&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;5. One-Click Rollbacks: Deploy Fearlessly&lt;/strong&gt; 🛡️
&lt;/h2&gt;

&lt;p&gt;Mistakes happen, but Vercel’s One-Click Rollbacks let you recover instantly. No downtime, no stress—just the confidence to innovate.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Why We Love It:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Instant Recovery&lt;/strong&gt;: Revert to a previous version in seconds.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;No Downtime&lt;/strong&gt;: Rollbacks are seamless, Users won’t notice a thing.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Risk-free deployments&lt;/strong&gt;: Experiment boldly, knowing you can undo mistakes.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;Real-Life Impact&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;Imagine pushing a buggy release during a high-stakes launch. Instead of scrambling to fix it under pressure, simply roll back to the last stable version and resolve the issue at your own pace.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;strong&gt;How It Works:&lt;/strong&gt;
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;Go to the &lt;a href="https://vercel.com/dashboard" rel="noopener noreferrer"&gt;&lt;strong&gt;Vercel Dashboard&lt;/strong&gt;.&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Navigate to your project and select the &lt;strong&gt;Deployments&lt;/strong&gt; tab.&lt;/li&gt;
&lt;li&gt;Click Redeploy for the desired version—and you’re live.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;One-click rollbacks are like having an undo button for your app, keeping stress at bay and workflows efficient. &lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion: Why Developers Choose Vercel&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Vercel isn’t just a platform; it’s a partner in your development journey. From blazing-fast edge performance to seamless collaboration and stress-free rollbacks, Vercel empowers developers to build confidently and innovate freely.&lt;/p&gt;

&lt;p&gt;Ready to experience the magic? &lt;a href="https://vercel.com/" rel="noopener noreferrer"&gt;Get started with Vercel today!&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>vercel</category>
      <category>react</category>
      <category>nextjs</category>
    </item>
    <item>
      <title>Deploying a Next.js application to Vercel (Beginner)</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Wed, 20 Nov 2024 14:32:04 +0000</pubDate>
      <link>https://dev.to/csituma/deploying-a-nextjs-application-to-vercel-beginner-15ak</link>
      <guid>https://dev.to/csituma/deploying-a-nextjs-application-to-vercel-beginner-15ak</guid>
      <description>&lt;p&gt;Deploying your Next.js application to Vercel is an easy process that ensures your project is live and accessible with minimal effort. &lt;/p&gt;

&lt;p&gt;Follow this step-by-step guide to achieve a successful deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Prerequisites:&lt;/strong&gt; 📑&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A fully developed Next.js project.&lt;/li&gt;
&lt;li&gt;An account on &lt;a href="https://github.com/" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, &lt;a href="https://gitlab.com/" rel="noopener noreferrer"&gt;GitLab&lt;/a&gt;, or &lt;a href="https://bitbucket.com/" rel="noopener noreferrer"&gt;Bitbucket&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;A &lt;a href="https://vercel.com/" rel="noopener noreferrer"&gt;Vercel &lt;/a&gt;account.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Prepare Your Next.js Application&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Before deployment, ensure your application is production-ready(Build).&lt;/p&gt;

&lt;p&gt;Navigate to your project directory and execute:&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;///This command compiles your application for production.&lt;/span&gt;
&lt;span class="nx"&gt;npm&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;build&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Test Locally:&lt;/p&gt;

&lt;p&gt;After building, start the application locally to verify its functionality:&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;npm&lt;/span&gt; &lt;span class="nx"&gt;run&lt;/span&gt; &lt;span class="nx"&gt;start&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At this stage, we need to have the application hosted on a remote platform to facilitate deployment.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Push Your Project to a Git Repository&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Vercel integrates seamlessly with Git platforms to facilitate deployments.&lt;/p&gt;

&lt;p&gt;Initialize Git:&lt;/p&gt;

&lt;p&gt;If your project isn't under &lt;a href="https://github.com/resources/articles/software-development/what-is-version-control?" rel="noopener noreferrer"&gt;version control&lt;/a&gt;:&lt;/p&gt;

&lt;p&gt;Create a Remote Repository&lt;/p&gt;

&lt;p&gt;On your preferred Git platform (GitHub, GitLab, or Bitbucket), create a new repository, then, on your local terminal:&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;git&lt;/span&gt; &lt;span class="nx"&gt;init&lt;/span&gt;
&lt;span class="nx"&gt;git&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="p"&gt;.&lt;/span&gt;
&lt;span class="nx"&gt;git&lt;/span&gt; &lt;span class="nx"&gt;commit&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;m&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Initial commit&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now that our remote repository exists, let's Push our Code!:&lt;/p&gt;

&lt;p&gt;Link your local repository to the remote one and push your code:&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;git&lt;/span&gt; &lt;span class="nx"&gt;remote&lt;/span&gt; &lt;span class="nx"&gt;add&lt;/span&gt; &lt;span class="nx"&gt;origin&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;repository&lt;/span&gt;&lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;url&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nx"&gt;git&lt;/span&gt; &lt;span class="nx"&gt;push&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt;&lt;span class="nx"&gt;u&lt;/span&gt; &lt;span class="nx"&gt;origin&lt;/span&gt; &lt;span class="nx"&gt;main&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Step 3: Deploy to Vercel&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://vercel.com/home" rel="noopener noreferrer"&gt;Sign-in&lt;/a&gt; to vercel using your Git provider&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpo37jc38qutkzltio7y.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ffpo37jc38qutkzltio7y.png" alt="vercel-log-in-page-log-with-github,gitlab-or-bitbucket" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Click on "Add New" in the Vercel dashboard:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5aly1e37mmz0udstm4n2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5aly1e37mmz0udstm4n2.png" alt="Add New button on vercel homepage menu" width="800" height="127"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Select Project&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feweyplqchvemmfp2awpj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feweyplqchvemmfp2awpj.png" alt="add-new-project-vercel-dashboard-button" width="367" height="424"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Import Your Project/Next.js repository&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F235gkrn1ogrz75qus2oe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F235gkrn1ogrz75qus2oe.png" alt="import-project-from-github-on-vercel" width="800" height="364"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Configure Project Settings:&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Vercel automatically detects Next.js projects and sets the appropriate configurations. Review the settings and make adjustments if necessary.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Deploy 🥳&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Click the "Deploy" button. Vercel will build and deploy your application. Once completed, you'll receive a unique URL to access your live application.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbgx2c2jsdj2fa4dtg4s.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fwbgx2c2jsdj2fa4dtg4s.png" alt="deploy-button-on-vercel-deploy-page" width="800" height="440"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Configure Custom Domain (Optional)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;To use a custom domain, Update your domain's DNS records as &lt;a href="https://vercel.com/docs/projects/domains/add-a-domain?" rel="noopener noreferrer"&gt;instructed by Vercel&lt;/a&gt; to point to their servers. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Update your domain's DNS records as instructed by Vercel to point to their servers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 5: Enable Continuous Deployment&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Vercel supports automatic deployments on every push to your Git repository.&lt;/p&gt;

&lt;p&gt;By default, Vercel redeploys your application on every push to the connected branch. You can manage these settings in your project's dashboard under the "Deployments" section.&lt;/p&gt;

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

&lt;p&gt;Deploying a Next.js application to Vercel is efficient and user-friendly, offering features like automatic scaling, global CDN, and seamless integration with Git platforms. By following this guide, your application will be live and ready to serve users.&lt;/p&gt;

&lt;p&gt;For more detailed information, refer to Vercel's &lt;a href="https://vercel.com/docs/frameworks/nextjs#next.js-on-vercel" rel="noopener noreferrer"&gt;official Next.js documentation.&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>react</category>
      <category>devops</category>
      <category>development</category>
    </item>
    <item>
      <title>Must know blockchain Terminologies.</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Mon, 01 Apr 2024 18:17:41 +0000</pubDate>
      <link>https://dev.to/csituma/must-know-blockchain-terminologies-5295</link>
      <guid>https://dev.to/csituma/must-know-blockchain-terminologies-5295</guid>
      <description>&lt;p&gt;&lt;strong&gt;Hash&lt;/strong&gt;: A hash is a unique string created to identify a specific set of data. It acts as a digital fingerprint for that data, ensuring its integrity and uniqueness.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hash Algorithm&lt;/strong&gt;: This is a specific computational function that takes an input (or 'message') and returns a fixed-size string of bytes. The output, known as the hash, is unique to each unique input. It's a one-way function, meaning that it's infeasible to invert or reverse the process to retrieve the original input from the hash.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Mining&lt;/strong&gt;: Mining is the process of solving complex cryptographic puzzles/riddles to validate transactions and secure the blockchain network. Miners compete to find a solution to a mathematical problem, and the first one to solve it gets to add a new block of transactions to the blockchain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nodes&lt;/strong&gt;: Nodes are computers connected to the blockchain network, each maintaining a copy of the blockchain. They participate in consensus processes and, in some blockchain models, are rewarded for mining or validating transactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Block&lt;/strong&gt;: A block is a collection of transactions that have been verified and combined into a single data structure. Each block is cryptographically linked to its predecessor, forming a chain of blocks or a blockchain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Nonce&lt;/strong&gt;: A nonce is a number that is used only once in cryptographic communication. In blockchain, it refers to an arbitrary number used to vary the hash in block mining until a specific condition is met. It also refers to the transaction number in Ethereum transactions.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Private Key&lt;/strong&gt;: A private key is a secure digital code known only to the owner, used to sign transactions. It proves the ownership of a blockchain address and allows the holder to access and spend their cryptocurrency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Public Key&lt;/strong&gt;: Derived from the private key using cryptographic algorithms, the public key is shared publicly. It allows others to verify the signature as valid, thus confirming the transaction's integrity without revealing the private key.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Address&lt;/strong&gt;: The address is a hashed version of the public key. It acts as the recipient's location on the blockchain where cryptocurrencies can be sent.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Blockchain&lt;/strong&gt;: A blockchain is a decentralized ledger or database that is distributed across the nodes of a computer network. It securely records transactions across many computers so that the record cannot be altered retroactively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consensus Mechanism&lt;/strong&gt;: This refers to the method used to achieve agreement on a single data value or a single state of the network among distributed processes or systems. Consensus mechanisms ensure all participants in the network agree on the validity of transactions.&lt;/p&gt;

&lt;p&gt;Examples include chain selection and mechanisms to prevent Sybil attacks (where one party tries to control a disproportionate number of nodes).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Sybil Resistance&lt;/strong&gt;: A property of blockchain networks that protects against attackers creating multiple false identities to gain a disproportionately large influence.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Proof of Stake (PoS)&lt;/strong&gt;: A consensus mechanism where the probability of validating a new block is proportional to one's ownership stake in the cryptocurrency.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Proof of Work (PoW)&lt;/strong&gt;: A consensus mechanism that requires participants to perform computationally intensive work to validate transactions and create new blocks.(Mining)&lt;br&gt;
It is used to deter denial of service attacks and other service abuses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Longest Chain Rule&lt;/strong&gt;: The principle that the path with the most blocks in a blockchain is considered the valid one, guiding network consensus.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 1&lt;/strong&gt;: The foundational layer of a blockchain infrastructure, supporting basic operations like transaction processing and consensus mechanisms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Layer 2&lt;/strong&gt;: Built on top of Layer 1, it enhances scalability and efficiency through solutions like sidechains or Lightning Networks, without altering the base layer.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Attacks&lt;/strong&gt;&lt;br&gt;
&lt;em&gt;&lt;strong&gt;Sybil Attack&lt;/strong&gt;&lt;/em&gt;: An attacker creates numerous fake identities to gain major influence over the network, aiming to disrupt its operations.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;&lt;strong&gt;51% Attack&lt;/strong&gt;&lt;/em&gt;: An entity controls over 50% of the network’s power, allowing them to manipulate transactions and potentially double-spend cryptocurrencies.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>blockchain</category>
      <category>web3</category>
      <category>beginners</category>
    </item>
    <item>
      <title>WHAT IS GAS IN BLOCKCHAIN?</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Sun, 31 Mar 2024 10:39:21 +0000</pubDate>
      <link>https://dev.to/csituma/gas-25p9</link>
      <guid>https://dev.to/csituma/gas-25p9</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2wckp1t6ppdmqkf519zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2wckp1t6ppdmqkf519zt.png" alt="clara_situma-blockchain-gas_fees" width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Whenever a transaction is executed on a blockchain, a miner or validator—someone operating the blockchain software—receives a small amount of the blockchain's currency as compensation.&lt;/p&gt;

&lt;p&gt;The amount they're paid depends on the gas fees associated with the transaction. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Gas&lt;/strong&gt; is a unit of measurement that quantifies the computational effort required to execute a transaction. The more complex the transaction, the higher the gas fee required. For example, sending Ether (ETH) typically incurs a low gas fee, whereas minting a Non-Fungible Token (NFT) demands a higher fee due to its complexity.&lt;/p&gt;

&lt;p&gt;Additionally, the overall demand on the blockchain influences gas prices; more transactions and higher activity levels mean higher gas fees, as the network becomes busier and more competitive for processing power.&lt;/p&gt;

&lt;p&gt;The cost of a transaction is determined by the formula: GAS PRICE * GAS USED = TRANSACTION FEE. The "gas price" is the amount of currency (e.g., ETH) that one is willing to pay per unit of gas, and the "gas used" represents the total amount of gas necessary to complete the transaction.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2wckp1t6ppdmqkf519zt.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2wckp1t6ppdmqkf519zt.png" alt="clara_situma-blockchain_gas_fees" width="800" height="208"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>blockchain</category>
      <category>web3</category>
      <category>defi</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React Usecallback for Kids/Beginners</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Thu, 08 Feb 2024 11:08:57 +0000</pubDate>
      <link>https://dev.to/csituma/react-usecallback-for-kidsbeginners-18df</link>
      <guid>https://dev.to/csituma/react-usecallback-for-kidsbeginners-18df</guid>
      <description>&lt;p&gt;Let's say we're making a webpage where we want to draw a smiley face every time we click a button. &lt;/p&gt;

&lt;p&gt;But drawing that smiley takes a lot of computer energy. &lt;/p&gt;

&lt;p&gt;So, we tell React to remember how to draw a smiley face using useCallback. &lt;/p&gt;

&lt;p&gt;Now, every time we click the button, React 'remembers' how to draw the smiley without using extra energy&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useCallback&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;SmileyComponent&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="c1"&gt;// This is our "spell" for drawing a smiley&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;drawSmiley&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useCallback&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;😊&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;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/* A button that, when clicked, will use the memorized drawSmiley function */&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;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;drawSmiley&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;Draw&lt;/span&gt; &lt;span class="nx"&gt;Smiley&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;SmileyComponent&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  Dependencies
&lt;/h2&gt;

&lt;p&gt;Think of useCallback like a magic notebook for your robot friend that helps it remember how to do a task (like building a sandcastle) the best way possible, without wasting energy. But if something important changes (like the weather), the robot knows it needs to update its notebook with new instructions. &lt;/p&gt;

&lt;p&gt;This way, your robot always builds the sandcastle perfectly, using the least amount of energy, and you both have more time to play and have fun at the beach!&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;MyCustomButton&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;memo&lt;/span&gt;&lt;span class="p"&gt;(({&lt;/span&gt; &lt;span class="nx"&gt;onClick&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="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;`Rendering button: &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="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;onClick&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;children&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;&lt;span class="p"&gt;});&lt;/span&gt;

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

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;useCallback&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;react&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;ColorBox&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;weather&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setWeather&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sunny&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// The weather condition&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;color&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setColor&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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yellow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Color of the box&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;updateColor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useCallback&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;weather&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sunny&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;yellow&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rainy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;gray&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;windy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;blue&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;break&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
      &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
        &lt;span class="nf"&gt;setColor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;green&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt; &lt;span class="c1"&gt;// Default color if weather is not recognized&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;weather&lt;/span&gt;&lt;span class="p"&gt;]);&lt;/span&gt; &lt;span class="c1"&gt;// The dependency array&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Weather&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;weather&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h2&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyCustomButton&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sunny&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Sunny&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MyCustomButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyCustomButton&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;rainy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Rainy&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MyCustomButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyCustomButton&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;setWeather&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;windy&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Windy&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MyCustomButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyCustomButton&lt;/span&gt; &lt;span class="nx"&gt;onClick&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;updateColor&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;Update&lt;/span&gt; &lt;span class="nx"&gt;Box&lt;/span&gt; &lt;span class="nx"&gt;Color&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MyCustomButton&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;{{&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;100px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;backgroundColor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;color&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="na"&gt;marginTop&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;20px&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="p"&gt;}}&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;Box&lt;/span&gt;
      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;ColorBox&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;useCallback with dependencies is a smart way for things (like your robot or a computer program) to remember how to do something efficiently, only changing their plan when they really need to, based on what's different. !&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>hook</category>
    </item>
    <item>
      <title>HTML IS JUST LIKE WRITING A WORD DOCUMENT</title>
      <dc:creator>Clara Situma</dc:creator>
      <pubDate>Fri, 14 Jul 2023 12:08:27 +0000</pubDate>
      <link>https://dev.to/csituma/html-is-just-like-writing-a-word-document-2m46</link>
      <guid>https://dev.to/csituma/html-is-just-like-writing-a-word-document-2m46</guid>
      <description>&lt;p&gt;Let's look at a quick word document:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Title: My First Document

Welcome to my Document!

This is a paragraph of text in my document. 
It's really quite an interesting paragraph, as paragraphs go. 
Here's a link to Google for more interesting content: www.google.com

Here is an image.
[IMAGE INSERTED]

Here is a list of my favorite fruits:
- Apples
- Oranges
- Bananas
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Now let's make it onto a website,using HTML&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="cp"&gt;&amp;lt;!DOCTYPE html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;html&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;head&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;title&amp;gt;&lt;/span&gt;My First Document&lt;span class="nt"&gt;&amp;lt;/title&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/head&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;Welcome to my Document!&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;This is a paragraph of text in my document. 
 It's really quite an interesting paragraph, as paragraphs go. 
Here's a link to the &lt;span class="nt"&gt;&amp;lt;a&lt;/span&gt; &lt;span class="na"&gt;href=&lt;/span&gt;&lt;span class="s"&gt;"http://www.google.com"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Google&lt;span class="nt"&gt;&amp;lt;/a&amp;gt;&lt;/span&gt; website for more interesting content.&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;img&lt;/span&gt; &lt;span class="na"&gt;src=&lt;/span&gt;&lt;span class="s"&gt;"your-image-source.jpg"&lt;/span&gt; &lt;span class="na"&gt;alt=&lt;/span&gt;&lt;span class="s"&gt;"An image in my document"&lt;/span&gt; &lt;span class="nt"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;p&amp;gt;&lt;/span&gt;Here is a list of my favorite fruits:&lt;span class="nt"&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;ul&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Apples&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Oranges&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;li&amp;gt;&lt;/span&gt;Bananas&lt;span class="nt"&gt;&amp;lt;/li&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/ul&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/html&amp;gt;&lt;/span&gt;

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

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Think of HTML tags as the equivalent of different elements in a Word document&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Each &lt;strong&gt;_tag _&lt;/strong&gt;serves a specific purpose and has a specific representation on the webpage. Let's dive in using our example:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;!DOCTYPE html:&lt;/em&gt;&lt;/strong&gt; This line is necessary to declare the document type and version of HTML. In this case, it's HTML5.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;html&lt;/em&gt;&lt;/strong&gt;: This is the root of an HTML document. Every tag that is used to display something on a webpage goes inside this tag.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;head&lt;/em&gt;&lt;/strong&gt;: This tag includes elements like the title of the document (which appears as the name of the tab in your web browser), links to stylesheets (CSS), character encoding declaration, and more. It's important to note that the content inside the &lt;/p&gt; tag does not appear on the webpage itself when viewed in a browser.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;&lt;em&gt;title:&lt;/em&gt;&lt;/strong&gt; This tag is nested within the &lt;/p&gt; tag, and is used to set the title of the webpage.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;body:&lt;/em&gt;&lt;/strong&gt; The body tag is where the content of the webpage goes - this is what users see when they visit your webpage.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;h1&lt;/em&gt;&lt;/strong&gt;: This tag is used to add a top-level heading, which is usually the title of the webpage or the highest-level section title.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;p:&lt;/em&gt;&lt;/strong&gt; This is a paragraph tag, which is used to denote text paragraphs.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;&lt;a href="http://www.ggogle.com" rel="noopener noreferrer"&gt;GOOGLE&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt;: This tag creates a hyperlink. The text between the opening &lt;a&gt; tag and the closing &lt;/a&gt; tag is the text that will appear as a clickable link on your webpage. The URL of the page you want to link to is specified in the href attribute.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;img&lt;/em&gt;&lt;/strong&gt;: This tag is used to embed images into your webpage. The source of the image (src) points to the location of the image file, while the alt attribute provides alternative text for the image if it cannot be displayed.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;&lt;em&gt;ul and li&lt;/em&gt;&lt;/strong&gt; : These tags are used to create unordered (bulleted) lists.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The &lt;strong&gt;ul&lt;/strong&gt; tag denotes the start of the list, and each list item is wrapped in an &lt;strong&gt;li&lt;/strong&gt; tag.&lt;/p&gt;

</description>
      <category>html</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
