<?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: Robin Rana</title>
    <description>The latest articles on DEV Community by Robin Rana (@mdrobin45r).</description>
    <link>https://dev.to/mdrobin45r</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%2F1950982%2F1d791186-b7e8-4943-a04b-a77d30178961.png</url>
      <title>DEV Community: Robin Rana</title>
      <link>https://dev.to/mdrobin45r</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/mdrobin45r"/>
    <language>en</language>
    <item>
      <title>Automating Server Deployments with GitHub Actions: Saving Time with SSH &amp; rsync 🚀</title>
      <dc:creator>Robin Rana</dc:creator>
      <pubDate>Sun, 30 Mar 2025 04:44:51 +0000</pubDate>
      <link>https://dev.to/mdrobin45r/automating-server-deployments-with-github-actions-saving-time-with-ssh-rsync-95e</link>
      <guid>https://dev.to/mdrobin45r/automating-server-deployments-with-github-actions-saving-time-with-ssh-rsync-95e</guid>
      <description>&lt;p&gt;🚀 I was working with GitHub Actions. I hadn’t explored it before, but I wanted to make my deployment process a bit smoother.&lt;/p&gt;

&lt;p&gt;🔄 The task wasn’t exactly deployment, it was more about sending updated files and folders to the server. Previously, I had to manually update the code on the server again and again, so I decided to automate the process using GitHub Actions.&lt;/p&gt;

&lt;p&gt;📜 To create a workflow in GitHub Actions, you need to define all instructions in a .yml file. Since I hadn’t worked with YAML before, I asked ChatGPT 🤖 to generate the structure for me. It included server configurations and commands for copying the main branch to the server using rsync 🚛.&lt;/p&gt;

&lt;p&gt;🔑 However, to make this work, you need SSH keys for authentication between GitHub and the server. At first, I was using them incorrectly 😅. For authentication, the public key 🔓 needs to be authorized on the server, and the private key 🔐 should be stored in the Secrets environment of the repository settings on GitHub. This way, GitHub acts as a client.&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 How SSH authentication works:
&lt;/h2&gt;

&lt;p&gt;SSH essentially works with a pair of keys:&lt;/p&gt;

&lt;p&gt;✅ Private key (secret key) → Must always be securely saved on the client (local server).&lt;/p&gt;

&lt;p&gt;✅ Public key → Stored on the remote server.&lt;/p&gt;

&lt;p&gt;📡 When the client sends an access request to the remote server, the private key on the client creates a digital signature ✍️. If this signature matches the public key’s signature on the remote server, access is granted ✅.&lt;/p&gt;

&lt;p&gt;In the end, I automated the transfer of project files between my GitHub repository and the server, saving me a lot of time. ⏳🚀&lt;/p&gt;

</description>
      <category>githubactions</category>
      <category>devops</category>
      <category>ssh</category>
      <category>serverdeployment</category>
    </item>
    <item>
      <title>🚀 Understanding Next.js Hydration Errors: Causes &amp; Fixes</title>
      <dc:creator>Robin Rana</dc:creator>
      <pubDate>Sun, 30 Mar 2025 04:41:31 +0000</pubDate>
      <link>https://dev.to/mdrobin45r/understanding-nextjs-hydration-errors-causes-fixes-463k</link>
      <guid>https://dev.to/mdrobin45r/understanding-nextjs-hydration-errors-causes-fixes-463k</guid>
      <description>&lt;p&gt;A common error in Next.js is the hydration error, which I often call the “national error” of Next.js 😅.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 What is Hydration?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 Why does this error occur?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;📌 How can it be resolved?&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  💡 What is Hydration?
&lt;/h2&gt;

&lt;p&gt;Hydration is the process of making a server-rendered HTML page interactive on the client side using JavaScript.&lt;/p&gt;

&lt;p&gt;When a user visits a website 🌐, the page is first rendered on the server before being sent to the browser. Think of it like ordering food online 🍔the restaurant (server) prepares the dish before delivering it to you.&lt;/p&gt;

&lt;p&gt;✅ Server rendering improves performance (the browser doesn’t have to render everything from scratch).&lt;/p&gt;

&lt;p&gt;✅ It also boosts SEO, allowing Google to crawl the content easily.&lt;/p&gt;

&lt;p&gt;Once the HTML arrives at the browser, JavaScript kicks in ⚡, making the page interactive — this process is known as hydration.&lt;/p&gt;

&lt;h2&gt;
  
  
  ❌ Why does a Hydration Error occur?
&lt;/h2&gt;

&lt;p&gt;Hydration errors happen when the server-rendered HTML 🖥️ does not match the client-rendered HTML.&lt;/p&gt;

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

&lt;p&gt;Let’s say you display the current time ⏰ inside a &lt;/p&gt;
&lt;p&gt; tag using React’s useEffect hook:&lt;/p&gt;

&lt;p&gt;`const TimeDisplay = () =&amp;gt; {&lt;br&gt;
  const [time, setTime] = useState("");&lt;/p&gt;

&lt;p&gt;useEffect(() =&amp;gt; {&lt;br&gt;
    setTime(new Date().toLocaleTimeString());&lt;br&gt;
  }, []);&lt;/p&gt;

&lt;p&gt;return &lt;/p&gt;
&lt;p&gt;{time}&lt;/p&gt;;&lt;br&gt;
};`

&lt;p&gt;If this component is server-rendered, the initial HTML will not include the time (because useEffect runs only on the client). When the client updates the component, the &lt;/p&gt;
&lt;p&gt; tag will now include the current time, causing a mismatch between server and client HTML—resulting in a hydration error.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;💡 Important:&lt;/strong&gt; useEffect runs only on the client, so it shouldn’t be relied upon for pre-rendered server components.&lt;/p&gt;

&lt;h2&gt;
  
  
  ✅ How to Fix Hydration Errors?
&lt;/h2&gt;

&lt;p&gt;🔹 Use static content for server-side rendering whenever possible.&lt;/p&gt;

&lt;p&gt;🔹 Handle dynamic data on the client side.&lt;/p&gt;

&lt;p&gt;🔹 Wrap dynamic elements inside a useEffect to prevent server-side rendering mismatches.&lt;/p&gt;

&lt;p&gt;🚀 By following these best practices, you can avoid hydration errors and build smoother Next.js applications!&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>hydrationerror</category>
      <category>ssr</category>
      <category>webdev</category>
    </item>
    <item>
      <title>A Game-Changing Feature in React 19</title>
      <dc:creator>Robin Rana</dc:creator>
      <pubDate>Thu, 12 Sep 2024 13:16:39 +0000</pubDate>
      <link>https://dev.to/mdrobin45r/a-game-changing-feature-in-react-19-251f</link>
      <guid>https://dev.to/mdrobin45r/a-game-changing-feature-in-react-19-251f</guid>
      <description>&lt;p&gt;One of the most exciting features in React 19 is the React Compiler, which takes React to the next level. In previous versions, React would prepare the code to run in the browser during the bundling process. But now, the React Compiler compiles React code directly into HTML, CSS, and JavaScript, making applications much faster.&lt;/p&gt;

&lt;p&gt;This kind of compiler already existed in Svelte, which is why Svelte has been significantly faster than React. With this new compiler, React 19 promises to boost performance much more.&lt;/p&gt;

&lt;p&gt;Additionally, React often re-renders the UI unnecessarily when the state changes, which used to require manual optimization using memoization techniques like &lt;code&gt;useMemo&lt;/code&gt;. React 19 will now handle these optimizations automatically, saving developers time and effort.&lt;/p&gt;

</description>
      <category>react19</category>
      <category>reactcompiler</category>
      <category>newreact</category>
    </item>
    <item>
      <title>Get More Style Power for Your Components with Tailwind Merge</title>
      <dc:creator>Robin Rana</dc:creator>
      <pubDate>Tue, 20 Aug 2024 09:23:17 +0000</pubDate>
      <link>https://dev.to/mdrobin45r/get-more-style-power-for-your-components-with-tailwind-merge-bab</link>
      <guid>https://dev.to/mdrobin45r/get-more-style-power-for-your-components-with-tailwind-merge-bab</guid>
      <description>&lt;p&gt;In the world of frontend development, utility-first CSS frameworks like Tailwind CSS have changed how we build modern web applications. But sometimes, managing all those utility classes can be tricky. That's where Tailwind Merge comes in handy.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Tailwind Merge?
&lt;/h3&gt;

&lt;p&gt;Tailwind Merge is a tool that smartly combines multiple Tailwind CSS classes. It makes sure that only the most specific (or the last) class takes effect when there are conflicting styles. This is especially useful in dynamic environments like React, Vue, or Svelte, where class names can change based on different conditions.&lt;/p&gt;

&lt;p&gt;Let’s look at a simple example. Suppose you have a button component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function Button({btnText}) {
  return (
    &amp;lt;button className="bg-blue-600 p-5"&amp;gt;{btnText}&amp;lt;/button&amp;gt;
  )
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This button has a fixed style. But what if you need to change the background color based on different situations? You might write something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export default function Button({ btnText, bgColor }) {
   return (
      &amp;lt;button className={`${bgColor ? bgColor : "bg-blue-500"} p-5`}&amp;gt;
         {btnText}
      &amp;lt;/button&amp;gt;
   );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This works fine for one or two style changes. But what happens when you need to modify more styles from different places? The code can get messy and hard to manage.&lt;/p&gt;

&lt;p&gt;Now, imagine you could apply different styles without writing all those conditions or changing the main component code. That’s where Tailwind Merge comes to the rescue. It handles everything for you, applying your utility classes in a smart way.&lt;/p&gt;

&lt;p&gt;Here’s how it works:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { twMerge } from "tailwind-merge";
export default function Button({ btnText, className }) {
   return (
      &amp;lt;button className={twMerge('bg-blue-500 p-5', className)}&amp;gt;
         {btnText}
      &amp;lt;/button&amp;gt;
   );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;code&gt;className&lt;/code&gt; can contain extra classes passed from another component or location. Tailwind Merge will automatically combine these with the default classes, resolving any conflicts. You just define the default style of the component as the first parameter, and then pass any additional styles in &lt;code&gt;className&lt;/code&gt; as the second parameter. Your code stays clean and readable, without needing to worry about conditions.&lt;/p&gt;

&lt;p&gt;Tailwind Merge is an excellent tool for anyone using Tailwind CSS, especially in complex or dynamic environments. By automatically resolving class conflicts and smoothly merging dynamic class names, it lets developers focus on building features instead of wrestling with CSS.&lt;/p&gt;

&lt;p&gt;Whether you're working on a big project or a small component, using Tailwind Merge will make your code cleaner and more maintainable, speeding up your development process.&lt;/p&gt;

&lt;p&gt;Give Tailwind Merge a try today and see how it can improve your Tailwind CSS projects! 🎨💻&lt;/p&gt;

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

</description>
      <category>tailwindcss</category>
      <category>conflictutilityclass</category>
    </item>
  </channel>
</rss>
