<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Average Developer]]></title><description><![CDATA[Average Developer]]></description><link>https://roshaan.codes</link><generator>RSS for Node</generator><lastBuildDate>Mon, 11 May 2026 18:46:21 GMT</lastBuildDate><atom:link href="https://roshaan.codes/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[6 Years Coding, 0 Things Shipped]]></title><description><![CDATA["Talk is cheap. Show me the code." — Linus Torvalds  
How can you call yourself a good painter if you have not made any painting in life. you can’t be good artist just by reading books or passing comments on other paint works. If you think you are go...]]></description><link>https://roshaan.codes/6-years-coding-0-things-shipped</link><guid isPermaLink="true">https://roshaan.codes/6-years-coding-0-things-shipped</guid><dc:creator><![CDATA[roshan shrestha]]></dc:creator><pubDate>Fri, 13 Feb 2026 14:44:42 GMT</pubDate><content:encoded><![CDATA[<p><em>"Talk is cheap. Show me the code." —</em> <strong><em>Linus Torvalds</em></strong>  </p>
<p>How can you call yourself a good painter if you have not made any painting in life. you can’t be good artist just by reading books or passing comments on other paint works. If you think you are good artist, just show me your work. period.</p>
<p>6 years in coding.<br />5 different job switch.<br />0 interview had to be given, thanks to referral and connections.<br />0 earned from my project cause,<br />0 live software/app.  </p>
<p>  Well, i am on that trap. Everyday i try to convince myself that i am the good developer, but i have nothing to show for. The funny thing is that, i convinced my self so hardly that i am the good developer, that i also went on teaching other to code? Like hello?? I don’t think i ever wanted to be teacher, maybe i was just looking for a escape? or maybe i was just looking for the validation;</p>
<p>I can’t name a single thing i have made in 6 years of my coding journey. Never created anything for me, or for anyone i love. Never earned singled dime from any of my project.</p>
<p>Here is a thing though, i love coding. i have been coding ever since i got my first laptop. I still remember spending multiple night trying to fix bugs, trying to make games or anything cool. I believe those were the final moments i ever had fun coding. Once i started working at office, once the first pay check arrived, i think i started to live off paycheck to paycheck.<br />My curiosity was sidelined by the family debt, “apps to build” never escape the paper, day one became one day. The thing i thought i will do on my free time, now required too much motivation to start.  Slowly i priority shifted, and working just enough to get paid became my new normal. Guilt never stop creeping though but;</p>
<p><strong><em>I got comfortable.</em></strong></p>
<p>Not happy, just comfortable. i didn’t had to make my own app, thanks to stable income. i couldn’t quite my job to start my own company, thanks to family debt.  So i did what every comfortable man does — stay in comfortable. Live my life of paycheck to paycheck. Maybe i overthink to much what other will say? There is a loud voice somewhere in me constantly remind me with “What others will think”. </p>
<p><em>“Oh you are going to build this app? bruh, anyone can build it. its nothing special” 
“Oh you think its the best solution? even a junior student can come up with better solution”<br />“Damn, can’t solve even this DSA problem? Who hired you?”</em>  </p>
<p>  Mind you these are not something other told me, its my brain convincing me to think this stuff.</p>
<p>That has been my biggest regret so far. Not that i don’t have my own company or my own app, just that i didn’t have courage to fail.  i failed to fail faster now all that is left is shy, under confident and too much comfortable person who regrets every decision.</p>
<p>Now i am leaving that version of myself behind. I am marking this blog as the first step to get uncomfortable. In fact i will just publish this blog without reading it twice. it will be like note to me for future.<br />I will not expect anything in return. I will just do cause i wanna do it. Keep building and publishing for myself.  May be next year, i will love the version of myself.  </p>
<p><em>"Everything you want is on the other side of fear."</em> — <strong>Jack Canfield</strong></p>
]]></content:encoded></item><item><title><![CDATA[Gogogaga, Learn Git like 5 years old]]></title><description><![CDATA[This command is just to give some description about what you did so far, this will help camera to remember even if you check it after a year. It can tell you exactly what, when, who was doing this.

Now you have the exact copy of your original work, ...]]></description><link>https://roshaan.codes/gogogaga-learn-git-like-5-years-old</link><guid isPermaLink="true">https://roshaan.codes/gogogaga-learn-git-like-5-years-old</guid><category><![CDATA[Git]]></category><category><![CDATA[Learn git]]></category><category><![CDATA[Gitcommands]]></category><dc:creator><![CDATA[roshan shrestha]]></dc:creator><pubDate>Sat, 29 Nov 2025 12:04:21 GMT</pubDate><content:encoded><![CDATA[<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764417150989/f5e61902-6e34-486e-85af-c3ed33a28414.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764396317488/412ac417-4678-4bbc-8def-bc3358753185.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764401346295/7d73b465-16b5-4905-9b14-235d025dda70.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764401455475/8164529b-517c-488c-9a8a-25bc2ad6488e.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764402060115/3e103bf7-8e1e-485e-a3c8-9ca62f2df222.png" alt class="image--center mx-auto" /></p>
<p>This command is just to give some description about what you did so far, this will help camera to remember even if you check it after a year. It can tell you exactly what, when, who was doing this.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764401606916/a62dc123-9773-4523-a060-41139a62100f.png" alt class="image--center mx-auto" /></p>
<p>Now you have the exact copy of your original work, even though its completely empty</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764396524109/2a15d29e-0863-4300-aee4-e765b2e6945d.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-but-wait-a-minute-you-notice-something-different-in-the-copy">» But wait a minute, you notice something different in the copy</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764402181172/9b5d3b7a-d17d-4763-9241-52b465ac0b5b.png" alt class="image--center mx-auto" /></p>
<h3 id="heading-congratulation-you-created-the-first-copy-with-version-number-the-hash-you-see-is-unique-to-your-work-so-it-wont-repeat-ever">Congratulation. You created the first copy with version number. The hash you see is unique to your work, so it won’t repeat ever.</h3>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764402763626/2152bedc-ef21-4a01-9c4a-1735ccce9976.png" alt class="image--center mx-auto" /></p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764403035964/f6088bd6-0982-40fb-8335-d5ade376449c.png" alt class="image--center mx-auto" /></p>
<p>So far, the above is our state, we have 1 original work we were doing and on the backup, we have 2 copy with different state version.</p>
<p>But opps, you did some mistake while making the another shape, and unfortunately you can’t erase it anymore.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764403466206/382b360e-ed15-4af8-8c20-43cafbfbd840.png" alt class="image--center mx-auto" /></p>
<p>This is where the git backup will be useful. You can just pull the copy and start working again, and delete the mistake original file, you can remove the original mistake file as we won’t need that again.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764403587352/0410a8ff-fc01-40d9-9c04-852335a3e59f.png" alt class="image--center mx-auto" /></p>
<p>Everytime we any changes and write,<br />git add all<br />&amp; git commit -m “Message” it just create another version that we can use later and modify whenever we want.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1764417731276/0ef15f69-5187-4b20-9595-af87694ec391.png" alt class="image--center mx-auto" /></p>
<p>thats why, once you use the git. You don’t have to worry about the versioning.</p>
<p>Alright, thats the start of the git. Alot to cover, see you kids on the next blog!<br />Gogogaga byee</p>
]]></content:encoded></item><item><title><![CDATA[Quick setup the Bootstarp and Laravel 9 in few steps   🚀]]></title><description><![CDATA[1) Project Setup:
I am going to use the composer to setup everything here.
composer create-project laravel/laravel simple-project-name
This will basically setup the new laravel project in your machine.
Once the setup is complete, cd simple-project-na...]]></description><link>https://roshaan.codes/quick-setup-the-bootstarp-and-laravel-9-in-few-steps</link><guid isPermaLink="true">https://roshaan.codes/quick-setup-the-bootstarp-and-laravel-9-in-few-steps</guid><category><![CDATA[Laravel]]></category><category><![CDATA[Laravel 9]]></category><category><![CDATA[Bootstrap]]></category><category><![CDATA[Bootstrap 5]]></category><dc:creator><![CDATA[roshan shrestha]]></dc:creator><pubDate>Tue, 22 Nov 2022 10:44:29 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1669111729878/qFonOguUd.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h3 id="heading-1-project-setup">1) Project Setup:</h3>
<p>I am going to use the composer to setup everything here.</p>
<pre><code>composer create-project laravel/laravel simple-project-name
</code></pre><p>This will basically setup the new laravel project in your machine.
Once the setup is complete, <code>cd simple-project-name</code> to move inside your project and
follow below code.</p>
<h3 id="heading-2-setup-laravel-ui-inside-project">2) Setup laravel ui inside project</h3>
<pre><code>composer <span class="hljs-built_in">require</span> laravel/ui
</code></pre><p>This add the <code>laravel/ui</code>  package inside your project. We will further use this ui package to add the bootstrap. </p>
<p><em>So far so good</em> , Hopefully you are not facing any issue till now. 
Moving on, </p>
<h3 id="heading-3-setup-the-bootstrap-5-using-php-artisan">3) Setup the bootstrap (5) using php artisan</h3>
<pre><code>php artisan ui bootstrap
</code></pre><p><em>Before we move on to another steps, make sure you have <a target="_blank" href="https://nodejs.org/en/download/"><strong>nodejs</strong></a> setup on your machine.</em></p>
<h3 id="heading-4-setup-up-dev-dependencies-using-npm">4) Setup up dev dependencies using NPM</h3>
<pre><code>npm install
</code></pre><p>and build everything </p>
<pre><code>npm run build
</code></pre><h3 id="heading-5-update-the-viteconfigjs">5) Update the vite.config.js</h3>
<p>Add the <code>resolve: {}</code> field just below the plugins inside the vite.config.js, </p>
<pre><code> resolve: {
        <span class="hljs-attr">alias</span>: {
            <span class="hljs-string">"~bootstrap"</span>: path.resolve(__dirname, <span class="hljs-string">"node_modules/bootstrap"</span>),
        },
    },
</code></pre><p><strong>Make sure to import the path at the top</strong></p>
<p>So now your vite config file should looks something like this:</p>
<pre><code><span class="hljs-keyword">import</span> { defineConfig } <span class="hljs-keyword">from</span> <span class="hljs-string">"vite"</span>;
<span class="hljs-keyword">import</span> laravel <span class="hljs-keyword">from</span> <span class="hljs-string">"laravel-vite-plugin"</span>;

<span class="hljs-keyword">import</span> path <span class="hljs-keyword">from</span> <span class="hljs-string">"path"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> defineConfig({
    <span class="hljs-attr">plugins</span>: [
        laravel({
            <span class="hljs-attr">input</span>: [<span class="hljs-string">"resources/sass/app.scss"</span>, <span class="hljs-string">"resources/js/app.js"</span>],
            <span class="hljs-attr">refresh</span>: <span class="hljs-literal">true</span>,
        }),
    ],
    <span class="hljs-attr">resolve</span>: {
        <span class="hljs-attr">alias</span>: {
            <span class="hljs-string">"~bootstrap"</span>: path.resolve(__dirname, <span class="hljs-string">"node_modules/bootstrap"</span>),
        },
    },
});
</code></pre><h3 id="heading-6-update-the-appjs-file-inside-the-resourcejs-folder">6) Update the app.js file inside the <code>resource/js</code> folder</h3>
<p>Just import the  <code>resource/scss/app.scss</code> file inside the  <code>resource/js/app</code></p>
<p>so now your app.js file should look like this</p>
<pre><code><span class="hljs-keyword">import</span> <span class="hljs-string">"./bootstrap"</span>;
<span class="hljs-comment">// add this like</span>
<span class="hljs-keyword">import</span> <span class="hljs-string">"../sass/app.scss"</span>;
</code></pre><h3 id="heading-7-now-finally-include-bootstrap-in-your-blade-template">7) Now finally include bootstrap in your blade template</h3>
<pre><code>@vite([<span class="hljs-string">'resources/js/app.js'</span>])
</code></pre><p>My app.blade.php looks like this</p>
<pre><code>&lt;!DOCTYPE html&gt;
&lt;html lang="en"&gt;

&lt;head&gt;
  &lt;meta charset="UTF-8"&gt;
  &lt;meta http-equiv="X-UA-Compatible" content="IE=edge"&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1.0"&gt;
  &lt;title&gt;Article App&lt;/title&gt;
// New like added here
  @vite(['resources/js/app.js'])
&lt;/head&gt;
</code></pre><p>Everything is now done, just make sure the restart the server by doing</p>
<pre><code>php artisan serve
</code></pre><p>And rebuild the npm package by</p>
<pre><code>npm run build
</code></pre><p>Or or or, 
just use the <a target="_blank" href="https://getbootstrap.com/docs/5.2/getting-started/introduction/">CDN</a> if you want to quickly start. </p>
<p><strong>Byeeeeeeeee</strong> 🍻</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1669113589850/T3vqRRLzC.jpeg" alt="814.jpeg" class="image--center mx-auto" /></p>
]]></content:encoded></item><item><title><![CDATA[Easy Form validation with YUP (+ Formik) in react (For beginners)]]></title><description><![CDATA[We just need 3 things to work, React , Formik & YUP (Obviously). 🤦

I will be assuming that you already setup the react and just looking something for the validating the form.
React Js:
Just incase if you haven't, here is the link to setup the react...]]></description><link>https://roshaan.codes/easy-form-validation-with-yup-formik-in-react-for-beginners</link><guid isPermaLink="true">https://roshaan.codes/easy-form-validation-with-yup-formik-in-react-for-beginners</guid><category><![CDATA[React]]></category><category><![CDATA[yup]]></category><category><![CDATA[formik]]></category><category><![CDATA[React]]></category><category><![CDATA[Validation]]></category><dc:creator><![CDATA[roshan shrestha]]></dc:creator><pubDate>Wed, 05 Oct 2022 14:36:11 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1669110144901/3UquWalN6.jpeg" length="0" type="image/jpeg"/><content:encoded><![CDATA[<p>We just need 3 things to work, <strong><a target="_blank" href="https://reactjs.org/">React</a></strong> , <strong><a target="_blank" href="https://formik.org/">Formik</a></strong> &amp; <strong><a target="_blank" href="https://www.npmjs.com/package/yup">YUP</a></strong> (Obviously). 🤦</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664970699412/ymBmPND4v.png" alt="image.png" class="image--center mx-auto" /></p>
<p>I will be assuming that you already setup the react and just looking something for the validating the form.</p>
<h3 id="heading-react-js">React Js:</h3>
<p>Just incase if you haven't, here is the link to setup the react <a target="_blank" href="https://reactjs.org/docs/create-a-new-react-app.html">link</a>. 🔗</p>
<h3 id="heading-formik">Formik:</h3>
<p>Setting up the Formik is also dead easy, <br />
just use the NPM or the YARN to install the formik on your project.</p>
<p>npm: <code>npm install formik --save</code>  <br />
yarn: <code>yarn add formik</code> </p>
<p>Now we need to setup the form, for that we need the <a target="_blank" href="https://formik.org/">Formik</a>. <br />
We can either useFormik hooks or directly import the <strong>Formik</strong>. </p>
<pre><code><span class="hljs-comment">// by implementing useFormik() hooks</span>
<span class="hljs-keyword">const</span> formik = useFormik({
     <span class="hljs-attr">initialValues</span>: {},
     <span class="hljs-attr">onSubmit</span>: <span class="hljs-function"><span class="hljs-params">values</span> =&gt;</span> {}, ...
   });
</code></pre><p>or directly using the Formik as the form, more classical approach per say,</p>
<pre><code><span class="hljs-comment">// using Formik as the Form.</span>
&lt;Formik onSubmit={} initialValues={}&gt;
&lt;/Formik&gt;
</code></pre><p>I will be using the formik hooks for this tutorial, feel free to use whatever you want.
Below we have the very simple Form made from the formik.</p>
<pre><code><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useFormik } <span class="hljs-keyword">from</span> <span class="hljs-string">"formik"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> formik = useFormik({
    <span class="hljs-attr">initialValues</span>: {
      <span class="hljs-attr">email</span>: <span class="hljs-string">""</span>
    },
    <span class="hljs-attr">onSubmit</span>: <span class="hljs-function">(<span class="hljs-params">values</span>) =&gt;</span> {
      <span class="hljs-comment">// simple code</span>
    }
  });
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">onSubmit</span>=<span class="hljs-string">{formik.handleSubmit}</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">input</span>
        <span class="hljs-attr">id</span>=<span class="hljs-string">"email"</span>
        <span class="hljs-attr">name</span>=<span class="hljs-string">"email"</span>
        <span class="hljs-attr">type</span>=<span class="hljs-string">"email"</span>
        <span class="hljs-attr">onChange</span>=<span class="hljs-string">{formik.handleChange}</span>
        <span class="hljs-attr">value</span>=<span class="hljs-string">{formik.values.email}</span>
        <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Email"</span>
      /&gt;</span>

      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
  );
}
</code></pre><p>Output: <br />
<img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664974906188/zFOk3nc-b.png" alt="Screen Shot 2022-10-05 at 6.46.27 PM.png" class="image--center mx-auto" /></p>
<h3 id="heading-yup">YUP</h3>
<p>Finally, lets add the YUP validation on the form. <br />
Installing yup on the project using npm and yarn: <br />
<code>npm install yup</code> or <code>yarn add yup</code> </p>
<p>For the sake of easiness, Let's say we want to add the validation where email must not be empty, or <strong>Required</strong> validation on email field. <br /></p>
<ol>
<li><p>First, import the YUP package where your code is, for me i will import on the code above. <br /></p>
<pre><code><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useFormik } <span class="hljs-keyword">from</span> <span class="hljs-string">"formik"</span>;
<span class="hljs-comment">// import like this</span>
<span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> yup <span class="hljs-keyword">from</span> <span class="hljs-string">"yup"</span>;
</code></pre></li>
<li><p>We need the create the validation schema, which is also very simple. <br /> </p>
<pre><code><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useFormik } <span class="hljs-keyword">from</span> <span class="hljs-string">"formik"</span>;
<span class="hljs-comment">// import like this</span>
<span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> yup <span class="hljs-keyword">from</span> <span class="hljs-string">"yup"</span>;

<span class="hljs-keyword">const</span> formSchema = yup.object().shape({
  <span class="hljs-attr">email</span>: yup.string().required(<span class="hljs-string">'Required'</span>),
 <span class="hljs-comment">// This will make sure that the email is string,</span>
 <span class="hljs-comment">// and value must not be empty.</span>
});
</code></pre><p>You can put any error message inside the <code>required("message-to-show-on-error")</code></p>
</li>
<li><p>Now all we have to do is link the yup schema and the formik form </p>
<pre><code><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useFormik } <span class="hljs-keyword">from</span> <span class="hljs-string">"formik"</span>;
<span class="hljs-comment">// import like this</span>
<span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> yup <span class="hljs-keyword">from</span> <span class="hljs-string">"yup"</span>;
<span class="hljs-keyword">const</span> formSchema = yup.object().shape({
  <span class="hljs-attr">email</span>: yup.string().required(<span class="hljs-string">'Required'</span>),
 <span class="hljs-comment">// This will make sure that the email is string,</span>
 <span class="hljs-comment">// and value must not be empty.</span>
});
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">const</span> formik = useFormik({
 <span class="hljs-attr">initialValues</span>: {
   <span class="hljs-attr">email</span>: <span class="hljs-string">""</span>
 },
<span class="hljs-comment">// &gt;&gt;&gt; Link schema here &lt;&lt;&lt;</span>
 <span class="hljs-attr">validationSchema</span>: formSchema,
 <span class="hljs-attr">onSubmit</span>: <span class="hljs-function">(<span class="hljs-params">values</span>) =&gt;</span> {
   <span class="hljs-comment">// simple code</span>
 }
});
<span class="hljs-keyword">return</span> (
 <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">onSubmit</span>=<span class="hljs-string">{formik.handleSubmit}</span>&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">input</span>
     <span class="hljs-attr">id</span>=<span class="hljs-string">"email"</span>
     <span class="hljs-attr">name</span>=<span class="hljs-string">"email"</span>
     <span class="hljs-attr">type</span>=<span class="hljs-string">"email"</span>
     <span class="hljs-attr">onChange</span>=<span class="hljs-string">{formik.handleChange}</span>
     <span class="hljs-attr">value</span>=<span class="hljs-string">{formik.values.email}</span>
     <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Email"</span>
   /&gt;</span>
   <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
 <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
);
}
</code></pre></li>
<li>Done! thats it, we have included the yup validation with formik. Just a small problem , how would we know if we have the error? Cause right now we don't have any mechanism to display the error message.  And my friend, that is also super simple. <br /> Simply add the following code where you want to see the error message, and it will work like charm.<pre><code>&lt;span&gt;{formik.errors.email}&lt;/span&gt;
</code></pre></li>
</ol>
<p>Final code will look something like this 👇</p>
<pre><code><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">"react"</span>;
<span class="hljs-keyword">import</span> { useFormik } <span class="hljs-keyword">from</span> <span class="hljs-string">"formik"</span>;
<span class="hljs-keyword">import</span> * <span class="hljs-keyword">as</span> yup <span class="hljs-keyword">from</span> <span class="hljs-string">"yup"</span>;

<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> <span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">App</span>(<span class="hljs-params"></span>) </span>{
  <span class="hljs-keyword">const</span> formSchema = yup.object().shape({
    <span class="hljs-attr">email</span>: yup.string().required(<span class="hljs-string">"Required"</span>)
  });
  <span class="hljs-keyword">const</span> formik = useFormik({
    <span class="hljs-attr">initialValues</span>: {
      <span class="hljs-attr">email</span>: <span class="hljs-string">""</span>
    },
    <span class="hljs-attr">validationSchema</span>: formSchema,
    <span class="hljs-attr">onSubmit</span>: <span class="hljs-function">(<span class="hljs-params">values</span>) =&gt;</span> {
      <span class="hljs-comment">// simple code</span>
      <span class="hljs-built_in">console</span>.log(values);
    }
  });
  <span class="hljs-keyword">return</span> (
    <span class="xml"><span class="hljs-tag">&lt;<span class="hljs-name">form</span> <span class="hljs-attr">onSubmit</span>=<span class="hljs-string">{formik.handleSubmit}</span>&gt;</span>
      <span class="hljs-tag">&lt;<span class="hljs-name">div</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">input</span>
          <span class="hljs-attr">id</span>=<span class="hljs-string">"email"</span>
          <span class="hljs-attr">name</span>=<span class="hljs-string">"email"</span>
          <span class="hljs-attr">type</span>=<span class="hljs-string">"email"</span>
          <span class="hljs-attr">onChange</span>=<span class="hljs-string">{formik.handleChange}</span>
          <span class="hljs-attr">value</span>=<span class="hljs-string">{formik.values.email}</span>
          <span class="hljs-attr">placeholder</span>=<span class="hljs-string">"Email"</span>
        /&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">br</span>&gt;</span><span class="hljs-tag">&lt;/<span class="hljs-name">br</span>&gt;</span>
        <span class="hljs-tag">&lt;<span class="hljs-name">span</span>&gt;</span>{formik.errors.email}<span class="hljs-tag">&lt;/<span class="hljs-name">span</span>&gt;</span>
      <span class="hljs-tag">&lt;/<span class="hljs-name">div</span>&gt;</span>

      <span class="hljs-tag">&lt;<span class="hljs-name">button</span> <span class="hljs-attr">type</span>=<span class="hljs-string">"submit"</span>&gt;</span>Submit<span class="hljs-tag">&lt;/<span class="hljs-name">button</span>&gt;</span>
    <span class="hljs-tag">&lt;/<span class="hljs-name">form</span>&gt;</span></span>
  );
}
</code></pre><p>Output: <br /></p>
<h4 id="heading-with-error">With Error</h4>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664978874436/KvO-x7bsP.png" alt="Screen Shot 2022-10-05 at 7.52.47 PM.png" />
<br />
And obviously looks ugly, which can be fixed with simple css/ styling. <br />
Congratulations! 🎉🎉  you have successfully used the formik and yup validation.</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664980299500/FpMdPi82o.gif" alt="giphy.gif" class="image--center mx-auto" /></p>
<p>Yup is super powerful, we can do all sorts of stuff like:</p>
<ul>
<li><pre><code>email: Yup.string().email(<span class="hljs-string">'Invalid email address'</span>).required(<span class="hljs-string">'Required'</span>),
</code></pre>To check for the valid email input + must not be empty</li>
<li><pre><code>firstName: Yup.string()
       .max(<span class="hljs-number">15</span>, <span class="hljs-string">'Must be 15 characters or less'</span>)
       .required(<span class="hljs-string">'Required'</span>),
</code></pre>To check for the non empty firstname field + firstName length of 15 character</li>
<li><pre><code>age: yup.number().required().positive().integer()
</code></pre>To check if the age is positive number + non empty <br /></li>
</ul>
<p>I will leave the example code here: https://codesandbox.io/s/vigilant-lamarr-fhscbj?file=/src/App.js:0-817 <br /><br />
Have fun experimenting on it. 👨‍🔬</p>
<p>Byeeee 👋👋👋👋👋</p>
<p><img src="https://cdn.hashnode.com/res/hashnode/image/upload/v1664980201454/d1M7UBKxj.gif" alt="hooray-its-weekend.gif" class="image--center mx-auto" /></p>
]]></content:encoded></item></channel></rss>