<?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: Robert Carsten</title>
    <description>The latest articles on DEV Community by Robert Carsten (@evrgreen).</description>
    <link>https://dev.to/evrgreen</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%2F447728%2Fff7ef3b1-549d-476b-931c-0b0a8620db4d.jpeg</url>
      <title>DEV Community: Robert Carsten</title>
      <link>https://dev.to/evrgreen</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/evrgreen"/>
    <language>en</language>
    <item>
      <title>100 Lessons, 100 Days: Day 3</title>
      <dc:creator>Robert Carsten</dc:creator>
      <pubDate>Wed, 12 Aug 2020 14:39:17 +0000</pubDate>
      <link>https://dev.to/evrgreen/100-lessons-100-days-day-3-36ko</link>
      <guid>https://dev.to/evrgreen/100-lessons-100-days-day-3-36ko</guid>
      <description>&lt;h1&gt;
  
  
  Day 3
&lt;/h1&gt;

&lt;p&gt;      What's that saying about 'the best laid plans of mice and men'? No sooner had I started this project then I caught some kind version of a cold (definitely not the one making the news) which prevented me from getting anything working Friday. Come this week and my neighborhood has been suffering blackouts which also prevent any work from occurring. &lt;/p&gt;

&lt;p&gt;      So once I was able to finely get my cursor blinking on my IDE all I could code up was a simple Sign-up page. But instead of feeling like a failure for making one of the most common features of the internet, I decided I could be satisfied with the practice of coding up yet another sign-up page. I did  want to look into using React-Hook-Form, for my form management. And after exploring it I did find their implementation of controlled forms to be compelling. &lt;/p&gt;

&lt;h1&gt;
  
  
  Lesson:
&lt;/h1&gt;

&lt;p&gt;       If Formik is your only experience with controlling forms in react, you owe it to yourself to check out react-hook-form. Using RHF's powerful useForm() hook gives you access to the main controller, error handling, submission for the form and so much more.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="s2"&gt;`import {useForm} from 'react-hook-form';

const [register,handleSubmit,errors] = useForm()
const onSubmit =  (formData)=&amp;gt;{     
    console.log(formdata.name)
}
&amp;lt;form onSubmit={handleSubmit(onSubmit)}&amp;gt;
    &amp;lt;div className='input-container'&amp;gt;
        &amp;lt;input name='name' id='name' ref={register}  
           required/&amp;gt;
        &amp;lt;label htmlFor='name'&amp;gt; Enter Name&amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;By passing the register as a ref to the input that is all you need to hand control of the input over to RHF. No need for an onChange attribute or even any chunk of state to hold the data from the input. &lt;/p&gt;

&lt;p&gt;      Once you submit the form RHF will pass any data held by any input as an object to the custom function you passed to their handleSubmit function. Coming from a history of crafting my forms by hand the handleSubmit function only is a compelling reason to switch. It even obviously gives you the option to pull any field out of the form data, of course this can be replicated using react state management but this is much simpler. &lt;/p&gt;

&lt;p&gt;       I also want to flex my CSS muscles a little and wanted to work on a fancy little floating label for my form. If we take a step back and think about how to achieve an effect similar to   &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--0KKBZTS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ozyqbb37xlpdj8zvj99.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--0KKBZTS5--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/5ozyqbb37xlpdj8zvj99.PNG" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;So we have a div with a label and  input inside, simple enough. So lets start with the container by giving it a &lt;code&gt;position:relative;&lt;/code&gt;. Moving to the label is where the secret sauce lies. We give it a position absolute, set its position to overlap with the actual label and then a transition for later&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;label{
    position:absolute;
    top:10%;
    left:15%; 
    transition: tranform 0.3s ease-out;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The final step (or what I like to call the secret secret sauce) is leveraging CSS valid and focus pseudo-selectors and the sibling selector (+). To achieve the effect all we really need is to transform the scale and translateY of the label and lower it's opacity.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;input:valid + label,
input:focus + label {
    transform: translateY(-30%), scale(0.7);
    opacity: 0.8;
    transition: transform 0.3s ease-out, opacity 0.3s                  ease;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;And that is all the coded needed for a little fancy effect for your Form. &lt;/p&gt;

&lt;p&gt;      So as simple as today's project was overcoming the multiple real life challenges  just reminds me the journey to mastering can only be taken one step at a time&lt;/p&gt;

</description>
    </item>
    <item>
      <title>100 Lessons 100 Days: Day 2</title>
      <dc:creator>Robert Carsten</dc:creator>
      <pubDate>Fri, 07 Aug 2020 07:00:46 +0000</pubDate>
      <link>https://dev.to/evrgreen/100-lessons-100-days-day-2-56n8</link>
      <guid>https://dev.to/evrgreen/100-lessons-100-days-day-2-56n8</guid>
      <description>&lt;h1&gt;
  
  
  Soothing Bubbles
&lt;/h1&gt;

&lt;p&gt;      Before I even get into the the what I actually learned about today I have to mention that my ideas for today's project started out as something wildly different. A simply app where you would click on the screen to place a particle emitter that would spray for a few seconds. Somewhere between the beginning and the end my wife caught a glimpse of the project, which was little more than pretty bubbles floating about and she became entranced by the way they danced across the screen. So I chucked my original idea in the bin and made an agile, dynamic paradigm shift(and perhaps several other buzzwords).&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson: Particles.js
&lt;/h2&gt;

&lt;p&gt;      I have made many animations in my career, from silky smooth transitions to the pulsing neon button that I swear sounded like a good idea at the time. However I have never really dipped my toe into more advanced animation on the net that the big names frameworks could provide. Wanting to start out small I turned to Particle.js to tackle first, or more specifically react-particle-js for ease of integration with the Next.js framework I had already built out. &lt;/p&gt;

&lt;p&gt;       I found the basics farely straight forward. Start with the install&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;npm install react-particle-js || yarn add react-particle-js&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Then once imported we can use the Particle component and customize it with the params attribute to customize it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import Particles from "react-particle-js"
const Bubble=()=&amp;gt;{
   return( 
     &amp;lt;Particles
        params={{
          background: {
            color: {
              value: '#0d47a1',
            },
          },
          particles: {
            number: {
              value: 150,
              density: {
                enable: true,
                value_area: 1200,
              },
            },
            color: {
              value: ['#E58F65', '#baf2e9', '#bad7f2', '#925e78', '#706993'],
            },
            size: {
              value: `${size}`,
              random: true,
              anim: {
                enable: true,
                speed: 5.2,
                size_min: 0.01,
              },
            },
            shape: {
              type: 'circle',
              stroke: {
                width: `${strokeSize}`,
                color: '#3fb7FF',
              },
            },
            links: {
              enable: false,
            },
          },
        }}
      /&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;I was surprised by the minute amount of code to get such an impressive effect. The final product uses some real basic state management to  control the size of the particle and the stroke around it, which offers some pretty cool effects (my favorite is particle size of 2 and stroke size of 500)&lt;/p&gt;

&lt;p&gt;       After digging around at some the of the examples of what others have created with Particles, I know it will be a tech I revisit several times in this series. &lt;/p&gt;

&lt;p&gt;That is all for today. You can find &lt;a href="%5Bhttps://site-a-day.vercel.app/%5D(https://site-a-day.vercel.app/)"&gt;100 Lessons, 100 Days&lt;/a&gt; at it's current home hosted by the great people at Vercel.  Never Stop Coding!!!&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
    <item>
      <title>100 lessons,100 days: Day 1</title>
      <dc:creator>Robert Carsten</dc:creator>
      <pubDate>Thu, 06 Aug 2020 06:04:53 +0000</pubDate>
      <link>https://dev.to/evrgreen/100-lessons-100-days-day-1-31fd</link>
      <guid>https://dev.to/evrgreen/100-lessons-100-days-day-1-31fd</guid>
      <description>&lt;h1&gt;
  
  
  100 lessons, 100 days
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Day 1
&lt;/h2&gt;

&lt;p&gt;      Much like countless developers before me I stared at those little green github squares that are so intrinsically linked to our self-worth as productive creators. I was facing that ever looming spectre that haunts us all "What should I work on next?"&lt;/p&gt;

&lt;p&gt;      I had a slew of little ideas that would make a fun toy application to play, but mulling them over in my head just didn't tickle that creative part of my brain. I had been recently finished a ton of research into a handful of technologies that I wanted to learn before the end of the year, so I knew whatever I picked would need to be something chunky that would covr everything. &lt;/p&gt;

&lt;p&gt;      I finally arrived on the, I won't call it a brilliant, idea that I will task myself with learning one new thing about web-development and I would do it by creating a new website every day. I needed to lay down some solid groundrules of course, nothing to restrictive&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;The Rules&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The challenge lasts 100 days, so 100 lessons learned, and hopefully 100 websites created&lt;/li&gt;
&lt;li&gt;Challenge runs Mon-Fri&lt;/li&gt;
&lt;li&gt;I create a blog post describing what I learned that day&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;

&lt;p&gt;       And that is it, Challenge accepted. &lt;/p&gt;

&lt;h1&gt;
  
  
  Lesson 1: Introduction to Next.js!
&lt;/h1&gt;

&lt;p&gt;      I have been hearing buzz about Next.js for sometime now, and coming from a background of pure React I was pretty interested in the features it boasted right out of the box. Today I created the 100 Lessons homepage today and just dipped my toes into the the basics of Next.js, and WOW it is a delight to work with. I love their filestructure based routing. It makes creating a SPA with client-side rendering. &lt;/p&gt;

&lt;p&gt;I'm excited to dive deeper into Next.js and the other tech on my list. &lt;br&gt;
That's all for my day 1 review, Never Stop Coding!!&lt;/p&gt;

</description>
      <category>webdev</category>
    </item>
  </channel>
</rss>
