<?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: govindbisen</title>
    <description>The latest articles on DEV Community by govindbisen (@govindbisen).</description>
    <link>https://dev.to/govindbisen</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%2F701427%2F8ea16634-ed37-44c1-9196-2807a2da501f.jpg</url>
      <title>DEV Community: govindbisen</title>
      <link>https://dev.to/govindbisen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/govindbisen"/>
    <language>en</language>
    <item>
      <title>(3)Hook - 1 . useState</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Sat, 06 Sep 2025 09:10:14 +0000</pubDate>
      <link>https://dev.to/govindbisen/hook-1-usestate-4p3i</link>
      <guid>https://dev.to/govindbisen/hook-1-usestate-4p3i</guid>
      <description>&lt;h2&gt;
  
  
  What is &lt;code&gt;useState&lt;/code&gt;?
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;useState&lt;/code&gt; is a React Hook that allows functional components to have state.&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;state&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setState&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="nx"&gt;initialState&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;state&lt;/code&gt; → current state value&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setState&lt;/code&gt; → function to update state&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;initialState&lt;/code&gt; → initial value&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Example: Simple Counter
&lt;/h2&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="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;Counter&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useState&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;increment&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;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&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;decrement&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;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt; &lt;span class="nx"&gt;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;textAlign&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;center&lt;/span&gt;&lt;span class="dl"&gt;'&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;50px&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="na"&gt;Counter&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;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;decrement&lt;/span&gt;&lt;span class="p"&gt;}&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;marginRight&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;10px&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;-&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="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;increment&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="o"&gt;&amp;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;Counter&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;count&lt;/code&gt; starts at &lt;code&gt;0&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Clicking &lt;code&gt;+&lt;/code&gt; increases the counter.&lt;/li&gt;
&lt;li&gt;Clicking &lt;code&gt;-&lt;/code&gt; decreases the counter.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;setCount&lt;/code&gt; updates state and triggers a re-render.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Tips
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Each &lt;code&gt;useState&lt;/code&gt; is independent.&lt;/li&gt;
&lt;li&gt;Always use the setter function to update state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Functional updates&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nf"&gt;setCount&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevCount&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;prevCount&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Functional initialization of state&lt;/strong&gt;:
&lt;/li&gt;
&lt;/ul&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="p"&gt;[&lt;/span&gt;&lt;span class="nx"&gt;count&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;setCount&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="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;homework&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="nx"&gt;learn&lt;/span&gt; &lt;span class="nx"&gt;where&lt;/span&gt; &lt;span class="nx"&gt;to&lt;/span&gt; &lt;span class="nx"&gt;use&lt;/span&gt; &lt;span class="nx"&gt;functional&lt;/span&gt; &lt;span class="nx"&gt;initializtion&lt;/span&gt; &lt;span class="nx"&gt;and&lt;/span&gt; &lt;span class="nx"&gt;update&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>usestate</category>
      <category>hook</category>
      <category>react</category>
    </item>
    <item>
      <title>react setup without vite or create react app,(2)</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Tue, 02 Sep 2025 16:36:34 +0000</pubDate>
      <link>https://dev.to/govindbisen/react-setup-without-vite-or-create-react-app2-3ifp</link>
      <guid>https://dev.to/govindbisen/react-setup-without-vite-or-create-react-app2-3ifp</guid>
      <description>&lt;h1&gt;
  
  
  🚀 Create React App Manually (Without CRA or Vite)
&lt;/h1&gt;

&lt;p&gt;Hey developers 👋,&lt;br&gt;
In this post, I’ll show you &lt;strong&gt;how to create a React app manually from scratch&lt;/strong&gt; without using &lt;code&gt;create-react-app&lt;/code&gt; or &lt;code&gt;Vite&lt;/code&gt;. This will help you understand the building blocks of React projects — what happens under the hood.&lt;/p&gt;

&lt;p&gt;👉 Full code is available on my GitHub: &lt;a href="https://github.com/govindbisen/manualreact" rel="noopener noreferrer"&gt;manualreact&lt;/a&gt;&lt;/p&gt;


&lt;h2&gt;
  
  
  1. Create a folder and initialize the project
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nb"&gt;mkdir &lt;/span&gt;manualreact
&lt;span class="nb"&gt;cd &lt;/span&gt;manualreact
npm init &lt;span class="nt"&gt;-y&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;The &lt;code&gt;-y&lt;/code&gt; flag accepts all defaults, so it quickly generates a &lt;code&gt;package.json&lt;/code&gt;.&lt;/p&gt;


&lt;h2&gt;
  
  
  2. Install React and ReactDOM
&lt;/h2&gt;


&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install &lt;/span&gt;react react-dom
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;react&lt;/strong&gt; → Core library for writing components, managing state, and using hooks.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;react-dom&lt;/strong&gt; → Used to render React components into the actual DOM (browser).&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 javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react-dom/client&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;App&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;./App&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;root&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;ReactDOM&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;createRoot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;document&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;getElementById&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;root&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
&lt;span class="nx"&gt;root&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;render&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;App&lt;/span&gt; &lt;span class="o"&gt;/&amp;gt;&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  3. But wait… browsers don’t understand JSX directly ⚠️
&lt;/h2&gt;

&lt;p&gt;Up to this point, we have written React code.&lt;br&gt;
But browsers only understand &lt;strong&gt;plain JavaScript, HTML, and CSS&lt;/strong&gt;.&lt;br&gt;
So we need tools that &lt;strong&gt;bundle&lt;/strong&gt; and &lt;strong&gt;transpile&lt;/strong&gt; our code:&lt;/p&gt;


&lt;h3&gt;
  
  
  🔹 Webpack (Bundler)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Takes all your files (&lt;code&gt;.js&lt;/code&gt;, &lt;code&gt;.css&lt;/code&gt;, &lt;code&gt;.jpg&lt;/code&gt;, etc.)&lt;/li&gt;
&lt;li&gt;Combines them into a single &lt;strong&gt;optimized bundle&lt;/strong&gt; (&lt;code&gt;bundle.js&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;Browser can then load it efficiently.&lt;/li&gt;
&lt;/ul&gt;


&lt;h3&gt;
  
  
  🔹 Babel (Transpiler)
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Converts modern &lt;strong&gt;ES6+&lt;/strong&gt; and &lt;strong&gt;JSX&lt;/strong&gt; code into older JavaScript that browsers understand.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Examples:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;JSX ➝ React.createElement&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ES6/JSX&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;element&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello React&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;h1&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Babel output:&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;element&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;createElement&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Hello React&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Arrow function ➝ ES5 function&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="c1"&gt;// ES6&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Babel output:&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;var&lt;/span&gt; &lt;span class="nx"&gt;sum&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;a&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="nx"&gt;b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  4. File Structure and Configurations
&lt;/h2&gt;

&lt;p&gt;I’ve set up all necessary files (&lt;code&gt;index.html&lt;/code&gt;, &lt;code&gt;webpack.config.js&lt;/code&gt;, &lt;code&gt;babel.config.js&lt;/code&gt;, entry point, etc.) in my repo.&lt;br&gt;
👉 You can check it out here: &lt;a href="https://github.com/govindbisen/manualreact" rel="noopener noreferrer"&gt;manualreact on GitHub&lt;/a&gt;&lt;/p&gt;




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

&lt;p&gt;By setting up React manually:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You understand &lt;strong&gt;how bundlers and transpilers work&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;You gain &lt;strong&gt;full control&lt;/strong&gt; over project configuration.&lt;/li&gt;
&lt;li&gt;It’s a great way to learn the internals behind &lt;code&gt;create-react-app&lt;/code&gt; and &lt;code&gt;Vite&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;💡 Pro tip: Once you’re comfortable with this, you can explore advanced Webpack loaders, plugins, and optimizations.&lt;/p&gt;




&lt;p&gt;👉 &lt;a href="https://github.com/govindbisen/manualreact" rel="noopener noreferrer"&gt;Check the complete project on GitHub, BUT do not download, write the code, install dependencies one by one, make each file one by one.&lt;/a&gt;&lt;/p&gt;




</description>
    </item>
    <item>
      <title>React application from scratch(1)</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Mon, 01 Sep 2025 16:43:13 +0000</pubDate>
      <link>https://dev.to/govindbisen/react-application-from-scratch1-1en5</link>
      <guid>https://dev.to/govindbisen/react-application-from-scratch1-1en5</guid>
      <description>&lt;p&gt;&lt;em&gt;Disclaimer : writing this series of article to help someone in need, if you are intermediate to advance,there is no need to read the series, but you can review and send the suggestions, I am doing what i like.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;There are multiple ways to create a React application:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Using Create React App – which I would say is outdated&lt;/li&gt;
&lt;li&gt;Using Vite(Faster)&lt;/li&gt;
&lt;li&gt;Setting it up manually (preferred)&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Using Create React App – which I would say is outdated
&lt;/h2&gt;

&lt;p&gt;`# Install globally (optional)&lt;br&gt;
npm install -g create-react-app&lt;/p&gt;

&lt;h1&gt;
  
  
  Create project
&lt;/h1&gt;

&lt;p&gt;npx create-react-app yourapplicationame&lt;/p&gt;

&lt;h1&gt;
  
  
  Go inside folder
&lt;/h1&gt;

&lt;p&gt;cd my-app&lt;/p&gt;

&lt;h1&gt;
  
  
  Run development server
&lt;/h1&gt;

&lt;p&gt;npm start&lt;/p&gt;

&lt;h1&gt;
  
  
  To build the app
&lt;/h1&gt;

&lt;p&gt;npm run build `&lt;/p&gt;

&lt;h2&gt;
  
  
  Using Vite(Faster)
&lt;/h2&gt;

&lt;p&gt;`# Create project&lt;br&gt;
npm create vite@latest my-app&lt;/p&gt;

&lt;h1&gt;
  
  
  Select options
&lt;/h1&gt;

&lt;h1&gt;
  
  
  Go inside folder
&lt;/h1&gt;

&lt;p&gt;cd my-app&lt;/p&gt;

&lt;h1&gt;
  
  
  Install dependencies
&lt;/h1&gt;

&lt;p&gt;npm install&lt;/p&gt;

&lt;h1&gt;
  
  
  Run dev server
&lt;/h1&gt;

&lt;p&gt;npm run dev`&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>resources</category>
    </item>
    <item>
      <title>Some un-common Errors I am facing during work -</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Tue, 16 Aug 2022 14:08:00 +0000</pubDate>
      <link>https://dev.to/govindbisen/property-razorpay-does-not-exist-on-type-window-typeof-globalthis-d0k</link>
      <guid>https://dev.to/govindbisen/property-razorpay-does-not-exist-on-type-window-typeof-globalthis-d0k</guid>
      <description>&lt;ol&gt;
&lt;li&gt;Property 'Razorpay' does not exist on type 'Window &amp;amp; typeof globalThis'.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I came across this error and it was not so easy for me to solve this, that's why creating this small article.&lt;/p&gt;

&lt;p&gt;I am working in ReactTs&lt;br&gt;
you will probably use &lt;br&gt;
 var rzp1 = new Razorpay(options); or &lt;br&gt;
 var rzp1 = new window.Razorpay(options);&lt;/p&gt;

&lt;p&gt;above your react class or function put&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;declare global {
  interface Window {
    // ⚠️ notice that "Window" is capitalized here
    Razorpay: any;
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2 . Getting proxy while &lt;code&gt;console.log(state)&lt;/code&gt; in cart Slice (Redux)&lt;/p&gt;

&lt;p&gt;solved by&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { current } from '@reduxjs/toolkit';
...
console.log(current(state));
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Code reference form input with useReducer</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Fri, 22 Apr 2022 10:32:56 +0000</pubDate>
      <link>https://dev.to/govindbisen/code-reference-form-input-with-redux-3pke</link>
      <guid>https://dev.to/govindbisen/code-reference-form-input-with-redux-3pke</guid>
      <description>&lt;p&gt;The code runs in App.js&lt;/p&gt;

&lt;p&gt;you can write Reducer function elsewhere to shorten you App component.&lt;br&gt;
code will run fine.&lt;/p&gt;

&lt;p&gt;I often suffer from lack of written working code for reference, hence I am making it.&lt;/p&gt;

&lt;p&gt;we will use useReducer hook from react function component to handle multiple input.&lt;/p&gt;

&lt;p&gt;Also find the logic for radio button how you handle initial value for radio button.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useReducer } from "react";

export default function App() {
  const formReducer = (state, action) =&amp;gt; {
    switch (action.type) {
      case "HandleInputText": {
        return {
          ...state,
          [action.field]: action.payload
        };
      }
      case "ToggleConsent": {
        return {
          ...state,
          hasConsented: !state.hasConsented
        };
      }
      default:
        return state;
    }
  };

  const initialState = {
    username: "",
    email: "",
    password: "",
    hasConsented: false,
    gender: "male"
  };

  const [formState, dispatch] = useReducer(formReducer, initialState);
  console.log(formState);
  // where dispatch is a method to trigger state updates/changes, reducer is a function we define which controls how we change the state, and initial state is an object with initial values defined, like the initialFormState example above.
  const handleChange = (e) =&amp;gt; {
    dispatch({
      type: "HandleInputText",
      field: e.target.name,
      payload: e.target.value
    });
  };

  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;h1&amp;gt; Reducer with form &amp;lt;/h1&amp;gt;
      &amp;lt;label&amp;gt;User Name &amp;lt;/label&amp;gt;
      &amp;lt;input
        type="text"
        name="username"
        value={formState.username}
        onChange={(e) =&amp;gt; handleChange(e)}
      /&amp;gt;{" "}
      &amp;lt;br /&amp;gt;
      &amp;lt;label&amp;gt;Email &amp;lt;/label&amp;gt;
      &amp;lt;input
        type="text"
        name="email"
        value={formState.email}
        onChange={(e) =&amp;gt; handleChange(e)}
      /&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;label&amp;gt;Password &amp;lt;/label&amp;gt;
      &amp;lt;input
        type="text"
        name="password"
        value={formState.password}
        onChange={(e) =&amp;gt; handleChange(e)}
      /&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;label&amp;gt;Gender &amp;lt;/label&amp;gt;
      &amp;lt;div onChange={(e) =&amp;gt; handleChange(e)}&amp;gt;
        &amp;lt;input
          type="radio"
          value="Male"
          name="gender"
          checked={formState.gender === "male"}
        /&amp;gt;{" "}
        Male
        &amp;lt;input
          type="radio"
          value="Female"
          name="gender"
          checked={formState.gender === "female"}
        /&amp;gt;{" "}
        Female
        &amp;lt;input type="radio" value="Other" name="gender" /&amp;gt; Other
      &amp;lt;/div&amp;gt;
      &amp;lt;br /&amp;gt;
      &amp;lt;label&amp;gt; i hearby Govind declare this that the code runs in react App &amp;lt;/label&amp;gt;
      &amp;lt;input
        type="checkbox"
        checked={formState.hasConsented}
        onChange={() =&amp;gt; dispatch({ type: "ToggleConsent" })}
      /&amp;gt;
      &amp;lt;button onClick={() =&amp;gt; console.log("printing", formState)}&amp;gt;
        print on console
      &amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;working code here&lt;br&gt;
&lt;a href="https://codesandbox.io/s/usereducerwithform-ubrz4m?file=/src/App.js:0-2542"&gt;https://codesandbox.io/s/usereducerwithform-ubrz4m?file=/src/App.js:0-2542&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;you can see warning also, please help me solve that warning.&lt;/p&gt;

&lt;p&gt;code is self explanatory but still if you want to understand you can talk to me, my whatsapp 8823011424 &lt;br&gt;
if you want to donate me please do 8823011424@upi no more than 1 rupee. &lt;/p&gt;

&lt;p&gt;Regards&lt;br&gt;
Govind &lt;/p&gt;

</description>
      <category>react</category>
      <category>radiobutton</category>
      <category>hook</category>
      <category>usereducer</category>
    </item>
    <item>
      <title>Stand Alone Redux, beginner's code reference to understand the flow...</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Thu, 21 Apr 2022 12:02:57 +0000</pubDate>
      <link>https://dev.to/govindbisen/redux-beginners-code-reference-4d0o</link>
      <guid>https://dev.to/govindbisen/redux-beginners-code-reference-4d0o</guid>
      <description>&lt;p&gt;Redux is a state management library, that keeps the state available application wide.  &lt;/p&gt;

&lt;p&gt;see the code of Redux without reactjs below&lt;br&gt;&lt;br&gt;
also now CreateStore is deprecated.&lt;/p&gt;
&lt;h2&gt;
  
  
  Redux Program 1
&lt;/h2&gt;

&lt;p&gt;keywords &lt;br&gt;
reducer -&amp;gt;store -&amp;gt; subscribe -&amp;gt; dispatch -&amp;gt; action&lt;/p&gt;

&lt;p&gt;run like a simple javascript file.&lt;/p&gt;

&lt;p&gt;npm init&lt;br&gt;
npm i redux&lt;br&gt;
node mycode.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const redux = require("redux");

const counterReducer = (state = { counter: 0 }, action) =&amp;gt; {
  if (action.type === "increment") {
    return {
      counter: state.counter + 1,
    };
  }
  if (action.type === "decrement") {
    return {
      counter: state.counter - 1,
    };
  }
  if (action.type === "multi5") {
    return {
      counter: state.counter * 5,
    };
  }
};
const store = redux.createStore(counterReducer);

const counterSubscriber = () =&amp;gt; {
  console.log(store.getState());
};

store.subscribe(counterSubscriber);

store.dispatch({ type: "increment" });
store.dispatch({ type: "multi5" });
store.dispatch({ type: "decrement" });

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

&lt;/div&gt;



&lt;h2&gt;
  
  
  redux-toolkit program 2
&lt;/h2&gt;

&lt;p&gt;do &lt;br&gt;
npm init&lt;br&gt;
npm install @reduxjs/toolkit&lt;br&gt;
node redux-toolkit.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import pkg from "@reduxjs/toolkit";
const { configureStore } = pkg;

const initialState = { value: 0, myName: "Govind" };

function counterReducer(state = initialState, action) {
  // Check to see if the reducer cares about this action
  if (action.type === "counter/increment") {
    // If so, make a copy of `state`
    return {
      ...state,
      // and update the copy with the new value
      value: state.value + 1,
    };
  }
  // otherwise return the existing state unchanged
  return state;
}

const store = configureStore({ reducer: counterReducer });

console.log(store.getState());

store.dispatch({ type: "counter/increment" });

console.log(store.getState());

//We can call action creators to dispatch the required  action
const increment = () =&amp;gt; {
  return {
    type: "counter/increment",
  };
};

store.dispatch(increment());

console.log(store.getState());
// {value: 2}

//Selectors
// Selectors are functions that know how to extract specific pieces of information from a store state value.
const selectCounterValue = (state) =&amp;gt; state.value;

const currentValue = selectCounterValue(store.getState());
console.log(currentValue); //2

const selectMyName = (state) =&amp;gt; state.myName;
const name = selectMyName(store.getState());
console.log(name);

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

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>Storing multiple values in one State</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Fri, 25 Mar 2022 13:22:55 +0000</pubDate>
      <link>https://dev.to/govindbisen/storing-multiple-values-in-one-state-177d</link>
      <guid>https://dev.to/govindbisen/storing-multiple-values-in-one-state-177d</guid>
      <description>&lt;p&gt;Hi,&lt;br&gt;
This is my Second smallest possible article. &lt;br&gt;
Pardon me for mistakes and improvement is highly welcomed. &lt;/p&gt;

&lt;p&gt;We will learn how we can store multiple values in single state using useState hook in functional component.&lt;br&gt;
&lt;a href="https://codesandbox.io/s/multipleinputinoneusestate-v1oz44?file=/src/App.js"&gt;demo&lt;/a&gt;&lt;/p&gt;
&lt;h1&gt;
  
  
  Step 1: import useState and set initial values
&lt;/h1&gt;

&lt;p&gt;initial values will be an object.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import "./styles.css";
import { useState } from "react";

export default function App() {
  const initialvalues = {
    fname: "",
    lname: ""
  };
  const [data, setData] = useState(initialvalues);

  return (
    &amp;lt;div className="App"&amp;gt;

    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 2:  add two input box
&lt;/h1&gt;

&lt;p&gt;values of input box will be data.fname data.lname, we will also assign name and id along with placeholder.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import "./styles.css";
import { useState } from "react";

export default function App() {
  const initialvalues = {
    fname: "",
    lname: ""
  };
  const [data, setData] = useState(initialvalues);

  return (
    &amp;lt;div className="App"&amp;gt;

      &amp;lt;input
        placeholder="enter name"
        value={data.fname}
        name="fname"
        id="fname"

      /&amp;gt;
      &amp;lt;input
        placeholder="enter surname"
        value={data.lname}
        name="lname"
        id="lname"

      /&amp;gt;

    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Step 3: adding OnChange event to each input box
&lt;/h1&gt;

&lt;p&gt;each input box will have onChange event, which will target to handleChange arrow function.&lt;br&gt;
 &lt;code&gt;const handleChange = (e) =&amp;gt; {&lt;br&gt;
    setData({ ...data, [e.target.name]: e.target.value });&lt;br&gt;
  };&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;As we know data is an object, so we can replace data.fname and data.lname using spread operator and reassigning new values of fname and lname using &lt;code&gt;{ ...data, key:"new Value" }&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;in this way &lt;code&gt;[e.target.name]: e.target.value&lt;/code&gt; will make new key value pair that will replace the previous key value pair.&lt;/p&gt;

&lt;p&gt;we will also add a button to print the values, we can use this button to submit values to our backend.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
import "./styles.css";
import { useState } from "react";

export default function App() {
  const initialvalues = {
    fname: "",
    lname: ""
  };
  const [data, setData] = useState(initialvalues);
  const display = () =&amp;gt; console.log(data);

  const handleChange = (e) =&amp;gt; {
    setData({ ...data, [e.target.name]: e.target.value });
  };
  return (
    &amp;lt;div className="App"&amp;gt;
      &amp;lt;input
        placeholder="enter name"
        value={data.fname}
        name="fname"
        id="fname"
        onChange={handleChange}
      /&amp;gt;
      &amp;lt;input
        placeholder="enter surname"
        value={data.lname}
        name="lname"
        id="lname"
        onChange={handleChange}
      /&amp;gt;
       &amp;lt;button onClick={display}&amp;gt;click&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;Demo-&amp;gt;&lt;br&gt;
&lt;a href="https://codesandbox.io/s/multipleinputinoneusestate-v1oz44?file=/src/App.js"&gt;demo&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you found this helpful, you can donate (8823011424@upi) me 1 rupee. It will encourage me to write more, believe me I want to write more, I am trying to save money for extra monitor as my 14 inch laptop is not good enough.&lt;/p&gt;

&lt;p&gt;Thank you!!&lt;/p&gt;

</description>
      <category>react</category>
      <category>usestate</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Wrapper Component in React</title>
      <dc:creator>govindbisen</dc:creator>
      <pubDate>Mon, 17 Jan 2022 11:19:06 +0000</pubDate>
      <link>https://dev.to/govindbisen/wrapper-component-in-react-5dn7</link>
      <guid>https://dev.to/govindbisen/wrapper-component-in-react-5dn7</guid>
      <description>&lt;h2&gt;
  
  
  Hi, I would like to introduce wrapper.
&lt;/h2&gt;

&lt;h2&gt;
  
  
  What is a wrapper?
&lt;/h2&gt;

&lt;p&gt;Wrapper is a react concept, it is like a  fragment &lt;code&gt;&amp;lt;&amp;gt;&amp;lt;/&amp;gt;&lt;/code&gt;  that covers any component or jsx as a blanket.&lt;/p&gt;

&lt;p&gt;If you will use material ui component or Ant design, most probably you will encounter wrappers.&lt;/p&gt;

&lt;p&gt;you can also make your own, let's have a look.&lt;/p&gt;

&lt;p&gt;Wrapper.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React from "react";

export default function Wrapper(props) {
  return props.children;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This simple wrapper component will return everything it covers, it will not add anything on it's your own.&lt;/p&gt;

&lt;p&gt;Now when you have build your own, you can use it anywhere in the project.&lt;/p&gt;

&lt;p&gt;Home.js&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Wrapper from "../wrapper/Wrapper";
export function Home() {
  let navigate = useNavigate();
  return (

      &amp;lt;Wrapper&amp;gt;
        I am home component...
       &amp;lt;button onClick={() =&amp;gt; navigate(`/Login`)}&amp;gt;go to login&amp;lt;/button&amp;gt; 
      &amp;lt;/Wrapper&amp;gt;

  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is my first article, As shortest as possible, if I have done any mistake, you are welcome to give me feedback, I will improve.&lt;/p&gt;

</description>
      <category>react</category>
      <category>javascript</category>
      <category>component</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
