<?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: Saurabh Ramesh Kacholiya</title>
    <description>The latest articles on DEV Community by Saurabh Ramesh Kacholiya (@saurabhkacholiya).</description>
    <link>https://dev.to/saurabhkacholiya</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%2F316167%2Fac080c87-6364-4cd9-8229-607cee632cb6.jpeg</url>
      <title>DEV Community: Saurabh Ramesh Kacholiya</title>
      <link>https://dev.to/saurabhkacholiya</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/saurabhkacholiya"/>
    <language>en</language>
    <item>
      <title>Creating a Contact Form: Key Learnings</title>
      <dc:creator>Saurabh Ramesh Kacholiya</dc:creator>
      <pubDate>Sun, 19 Nov 2023 17:03:20 +0000</pubDate>
      <link>https://dev.to/saurabhkacholiya/creating-a-contact-form-key-learnings-412i</link>
      <guid>https://dev.to/saurabhkacholiya/creating-a-contact-form-key-learnings-412i</guid>
      <description>&lt;h4&gt;
  
  
  1. Form Structure:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Action Attribute:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;action&lt;/code&gt; attribute to specify the URL where the form data should be submitted. Example: &lt;code&gt;action="some URL"&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Method Attribute:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Set the &lt;code&gt;method&lt;/code&gt; attribute to "post" to send form data securely.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Button Type:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The default button type is "submit." Placing it inside the form will trigger the &lt;code&gt;onSubmit&lt;/code&gt; event of the &lt;code&gt;&amp;lt;form&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;&lt;strong&gt;Input Naming:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Passing a &lt;code&gt;name&lt;/code&gt; attribute in the input tags establishes the key in the form data.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;Example:&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="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;action=&lt;/span&gt;&lt;span class="s"&gt;"some URL"&lt;/span&gt; &lt;span class="na"&gt;method=&lt;/span&gt;&lt;span class="s"&gt;"post"&lt;/span&gt; &lt;span class="na"&gt;onSubmit=&lt;/span&gt;&lt;span class="s"&gt;{onSubmit}&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;htmlFor=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Name:&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"name"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

       &lt;span class="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;htmlFor=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Email:&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
       &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"email"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;

       &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"submit"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  2. Label Accessibility:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;HTML for Attribute:&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Use the &lt;code&gt;for&lt;/code&gt; attribute in the &lt;code&gt;&amp;lt;label&amp;gt;&lt;/code&gt; tag to associate it with a specific input using the &lt;code&gt;id&lt;/code&gt; of that input.&lt;/li&gt;
&lt;/ul&gt;


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

&lt;p&gt;Example:&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="nt"&gt;&amp;lt;label&lt;/span&gt; &lt;span class="na"&gt;htmlFor=&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Username:&lt;span class="nt"&gt;&amp;lt;/label&amp;gt;&lt;/span&gt;
   &lt;span class="nt"&gt;&amp;lt;input&lt;/span&gt; &lt;span class="na"&gt;type=&lt;/span&gt;&lt;span class="s"&gt;"text"&lt;/span&gt; &lt;span class="na"&gt;id=&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt; &lt;span class="na"&gt;name=&lt;/span&gt;&lt;span class="s"&gt;"username"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This ensures improved accessibility and helps screen readers understand the relationship between labels and inputs.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Thinking twice before writing IF</title>
      <dc:creator>Saurabh Ramesh Kacholiya</dc:creator>
      <pubDate>Mon, 27 Sep 2021 13:19:26 +0000</pubDate>
      <link>https://dev.to/saurabhkacholiya/thinking-twice-before-writing-if-n45</link>
      <guid>https://dev.to/saurabhkacholiya/thinking-twice-before-writing-if-n45</guid>
      <description>&lt;p&gt;Recently I come across a very healthy discussion with my manager about writing &lt;strong&gt;IF condition&lt;/strong&gt; &lt;/p&gt;

&lt;p&gt;so whenever you are writing if condition as a developer we open a decision tree (for example yes and no) and when the codebase increases more branching of decisions paths are introduced in the code resulting in difficulty to read and debug the code.&lt;/p&gt;

&lt;p&gt;To avoid we can use Composition where we are directly passing the render component to child components from the parent as shown in the above image. This way we are also using dumb components to avoid side effects in the children components.&lt;/p&gt;

&lt;p&gt;PS. I know it is not worthy to replace every IF the condition from your codebase. I also don't do that. that is why the blog title is Thinking twice before writing if and still, you feel you cant work without if go on use &lt;strong&gt;IF condition&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>codequality</category>
    </item>
  </channel>
</rss>
