<?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: Vitor Paladini</title>
    <description>The latest articles on DEV Community by Vitor Paladini (@vtrpldn).</description>
    <link>https://dev.to/vtrpldn</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%2F169109%2F6820fd4d-7891-4d6b-863a-92f8380be31b.png</url>
      <title>DEV Community: Vitor Paladini</title>
      <link>https://dev.to/vtrpldn</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/vtrpldn"/>
    <language>en</language>
    <item>
      <title>How to Overcome Your TypeScriptoPhobia</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Mon, 31 Jan 2022 12:49:03 +0000</pubDate>
      <link>https://dev.to/vtrpldn/how-to-overcome-your-typescriptophobia-2j26</link>
      <guid>https://dev.to/vtrpldn/how-to-overcome-your-typescriptophobia-2j26</guid>
      <description>&lt;p&gt;Let's face it, TypeScript is &lt;a href="https://stackoverflow.com/questions/57051334/how-to-understand-complicated-typescript-generic-types" rel="noopener noreferrer"&gt;kinda scary&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaladini.dev%2Fimg%2Fscary-typescript-example.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaladini.dev%2Fimg%2Fscary-typescript-example.png" alt="scary typescript example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Not too long ago, I used to dread the idea of having to learn and work with it every day.&lt;/p&gt;

&lt;p&gt;I'd log off after a busy day at work and have a recurring nightmare where a mob of angry engineers forced me to either use it or face a slow, painful demise. I also couldn't run or fight in the dream, my punches were super slow, and all my teeth would crumble and fall...&lt;/p&gt;

&lt;p&gt;Alright, I'm deviating here, but you get the idea.&lt;/p&gt;

&lt;p&gt;And now, after a little more than a year of daily TypeScript exposure I... Kind of love it? I'm not sure if "love" is the right word here, but we're surely on amicable terms now.&lt;/p&gt;

&lt;p&gt;Using it makes my job so much easier (after making it much harder for a while, let's be honest), and I regret not putting in the effort to learn it earlier in my career.&lt;/p&gt;

&lt;p&gt;And that's the reason I'm here today. I want you to learn from my mistakes, eat that damn frog, and start putting some effort into learning TypeScript today!&lt;/p&gt;

&lt;p&gt;🎵 &lt;a href="https://www.youtube.com/watch?v=bWcASV2sey0" rel="noopener noreferrer"&gt;cue motivational song&lt;/a&gt; 🎵&lt;/p&gt;

&lt;p&gt;&lt;em&gt;But first&lt;/em&gt;, let's talk about why I avoided it so much.&lt;/p&gt;

&lt;h2&gt;
  
  
  I used to hate the idea of using it
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Hate is a consequence of fear. Fear is a consequence of ignorance. - Albert Einstein (&lt;a href="https://www.goodreads.com/quotes/8833090-ignorance-leads-to-fear-fear-leads-to-hatred-and-hatred" rel="noopener noreferrer"&gt;not really&lt;/a&gt;)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As human beings, we have emotional responses for every stimulus, and &lt;em&gt;boy&lt;/em&gt;, I used to have strong feelings right inside my gut whenever TypeScript popped up on my Twitter feed.&lt;/p&gt;

&lt;p&gt;Back then, it looked like &lt;em&gt;one extra thing&lt;/em&gt; to learn atop a couple dozen new JS stuff, the syntax looked like something straight out of a &lt;a href="https://en.wikipedia.org/wiki/Enigma_machine" rel="noopener noreferrer"&gt;World War II cryptography machine&lt;/a&gt;, and it felt like I could accomplish the same thing with good old JS.&lt;/p&gt;

&lt;p&gt;It all sounded like way too much effort. 😮‍💨&lt;/p&gt;

&lt;p&gt;"It will just make me slower!", "It will be another dev dependency to go haywire and break my env!", "I could use that time to write tests!" - I thought.&lt;/p&gt;

&lt;p&gt;There is &lt;em&gt;some&lt;/em&gt; truth to these thoughts, the syntax does indeed resemble an Enigma machine sometimes, and yes, &lt;em&gt;it is&lt;/em&gt; &lt;a href="https://medium.com/javascript-scene/why-im-thankful-for-js-fatigue-i-know-you-re-sick-of-those-words-but-this-is-different-296fae0c888f" rel="noopener noreferrer"&gt;one more thing to learn&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;But at the deep end, I was simply afraid of the unknown, too comfortable with my JS-only experience, and very good at unconsciously coming up with excuses.&lt;/p&gt;

&lt;p&gt;And all that prevented me from seeing the benefits it could bring to my workflow.&lt;/p&gt;

&lt;p&gt;It's kind of like when you're meeting a new person but already have so many negative preconceptions that you instantly hate them. In my case, that person was called TypeScript, a funny name for a person to have if you ask me.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I kind of love it now
&lt;/h2&gt;

&lt;p&gt;I kind of love it for a few reasons, it makes my job easier, sure, but I only got to love it once I got to know it.&lt;/p&gt;

&lt;p&gt;And I only got to know it because I put myself in a position where I was forced to use it every single day.&lt;/p&gt;

&lt;p&gt;I mean, not really &lt;em&gt;forced&lt;/em&gt;, but after applying and being hired to a TypeScript-heavy position, I had to damn well get rid of my TypeScriptoPhobia and learn it good.&lt;/p&gt;

&lt;p&gt;And here's what I discovered along the way!&lt;/p&gt;

&lt;h3&gt;
  
  
  TypeScript facilitates communication, like, a lot
&lt;/h3&gt;

&lt;p&gt;TypeScript has a lot of advantages but the thing I like &lt;strong&gt;the most&lt;/strong&gt; in using it is how it forces you to give good names to stuff, especially objects.&lt;/p&gt;

&lt;p&gt;In the example below, you'd be able to say something like, "Hey Jess, this method takes a &lt;strong&gt;User&lt;/strong&gt; as param" instead of "takes an object with id, name, and email as mandatory properties."&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;function&lt;/span&gt; &lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://example.com/user/create&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
    &lt;span class="p"&gt;...&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;p&gt;vs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="nx"&gt;User&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;id&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="na"&gt;name&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
    &lt;span class="na"&gt;email&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kr"&gt;string&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}:&lt;/span&gt; &lt;span class="nx"&gt;User&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="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;https://example.com/user/create&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;method&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;POST&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
      &lt;span class="na"&gt;body&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;JSON&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;stringify&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;&lt;span class="nx"&gt;id&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;name&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;email&lt;/span&gt;&lt;span class="p"&gt;}),&lt;/span&gt;
      &lt;span class="p"&gt;...&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;p&gt;This single change in your team's workflow makes the implementation much more straightforward to discuss during code reviews, RFCs, and pair-programming sessions.&lt;/p&gt;

&lt;p&gt;That also works very well when working with well-typed dependencies. For instance, when discussing a specific API method, you can say it accepts a &lt;a href="https://developers.google.com/maps/documentation/javascript/reference/coordinates#LatLngLiteral" rel="noopener noreferrer"&gt;LatLngLiteral&lt;/a&gt; instead of "an object with lat and lng properties as &lt;code&gt;number&lt;/code&gt;."&lt;/p&gt;

&lt;h3&gt;
  
  
  It actually eases your mental workload over time
&lt;/h3&gt;

&lt;p&gt;TS will make you slower before making you faster, and the sooner you accept that, the better.&lt;/p&gt;

&lt;p&gt;But after going through an initial learning curve and type setup, you'll see how a robust type system and a reliable autocomplete saves you some critical mental bandwidth.&lt;/p&gt;

&lt;p&gt;Your focus will no longer be interrupted by thoughts like "does this method take an object or an array of strings?" and "I'm not sure if I should explicitly set this argument as null or if I can leave it as undefined...".&lt;/p&gt;

&lt;p&gt;TypeScript makes it so that you write the answers before &lt;em&gt;even thinking&lt;/em&gt; about the questions. If you try something that doesn't match your declared types, your code editor will let you know instantly.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here's another scenario:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You're using a framework or dependency you're not super familiar with. You've been through the docs a couple of times but only learned about some key concepts.&lt;/p&gt;

&lt;p&gt;Instead of rummaging through the API docs hundreds of times to see if a specific method is called &lt;code&gt;createUser()&lt;/code&gt;, &lt;code&gt;createNewUser()&lt;/code&gt;, or &lt;code&gt;createEntity('user', ...)&lt;/code&gt; you can type down "create", let your editor autocomplete work for you and save countless alt+tabs to the docs page.&lt;/p&gt;

&lt;h3&gt;
  
  
  It helps you sleep better at night
&lt;/h3&gt;

&lt;p&gt;As your project grows, TypeScript makes it harder for you to shoot yourself in the foot. Harder but not impossible, as self-sabotage is a quintessential aspect of software engineering.&lt;/p&gt;

&lt;p&gt;You know, your vanilla JS codebase might look cute and harmless now in its infancy, but you know that if left unattended for too long (or feed it after midnight), it will start to go wild.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaladini.dev%2Fimg%2Fgizmo.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fpaladini.dev%2Fimg%2Fgizmo.jpg" alt="gizmo from gremlins"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;It might be challenging to picture that scenario if you've never got close to a vast JS-only project, but trust me, things get &lt;em&gt;messy&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;I like TypeScript because it makes your codebase "tighter" in a good way.&lt;/p&gt;

&lt;p&gt;It takes away some of that crazy flexibility and permissiveness of JavaScript and creates an environment where you &lt;em&gt;must&lt;/em&gt; think a little bit deeper about how you'll organize your data.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;After you put in the effort of learning TS, JS codebases feel like poorly built toy that does work, but rattles a lot when you pick it up and shake it close to your ear. You just don't trust it as much.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Every time you write and use a new type, you create a new constrain that prevents you from making bad decisions. And consequently, the trust you have in your own code increases.&lt;/p&gt;

&lt;p&gt;Add that to a well-configured CI that checks for TS errors before build, and you'll have a safety net that prevents you from shipping embarrassing (and 100% avoidable) type errors.&lt;/p&gt;

&lt;p&gt;Combine that with a well-tested application, and your sleep quality will improve ten-fold during release weeks.&lt;/p&gt;

&lt;h2&gt;
  
  
  How and where to start
&lt;/h2&gt;

&lt;p&gt;Now, you might not have that very strong "my new job literally depends on learning TypeScript" kind of motivation, so that's what this section is all about.&lt;/p&gt;

&lt;p&gt;I'm confident that by now, I've at least made you consider trying it, so here are a few suggestions on how to start.&lt;/p&gt;

&lt;p&gt;Just keep in mind that &lt;a href="https://www.youtube.com/watch?v=Gu8YiTeU9XU" rel="noopener noreferrer"&gt;sucking at something&lt;/a&gt; is the first step toward being sorta good at something.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Sit down, grab a warm beverage, and read through the docs
&lt;/h3&gt;

&lt;p&gt;This sounds obvious, but I'd like to stress how good &lt;a href="https://www.typescriptlang.org/docs/" rel="noopener noreferrer"&gt;the TS intro material&lt;/a&gt; is. Really, it's got dedicated guides for new programmers, for people with some JS experience, for functional programmers, it is excellent.&lt;/p&gt;

&lt;p&gt;Learning styles differ from person to person, but I'm sure that having the theory basics before getting down to business will help you immensely.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Start slow with a new project
&lt;/h3&gt;

&lt;p&gt;A calculator, a to-do list, a neat project with Spotify API + react-three-fiber, a large-scale CRM to rival Salesforce's biggest efforts. It doesn't matter what it is as long as it is funny enough to keep you engaged.&lt;/p&gt;

&lt;p&gt;Just run &lt;code&gt;$ yarn create next-app --typescript&lt;/code&gt; and go to town!&lt;/p&gt;

&lt;p&gt;There's one rule, though. Use &lt;code&gt;@ts-ignore&lt;/code&gt; or type &lt;code&gt;any&lt;/code&gt; and you lose. This will be the golden rule to keep you focused when TypeScript starts testing your faith.&lt;/p&gt;

&lt;p&gt;And it will.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Gradually migrate a JS project to TypeScript
&lt;/h3&gt;

&lt;p&gt;TypeScript came around when people already had a lot of JavaScript projects up and running. So it is no surprise that we can find a lot of migration tools and guides.&lt;/p&gt;

&lt;p&gt;That said, a great way to start cracking some TypeScript is by cloning a JS repo and migrating it to TS. It can be some old project of yours or that small abandoned script on your company's GitHub page.&lt;/p&gt;

&lt;p&gt;You can use AirBnb's &lt;a href="https://github.com/airbnb/ts-migrate" rel="noopener noreferrer"&gt;ts-migrate tool&lt;/a&gt; or try a more direct tactic following the &lt;a href="https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html" rel="noopener noreferrer"&gt;Migrating from JavaScript&lt;/a&gt; guide.&lt;/p&gt;

&lt;p&gt;This approach is somewhat different from the previous suggestion as type &lt;code&gt;any&lt;/code&gt; will be a good friend while you sort out a myriad of type errors. But you'll get there; you just gotta keep pushing forward.&lt;/p&gt;

&lt;h2&gt;
  
  
  Some tips before you start
&lt;/h2&gt;

&lt;p&gt;But wait, there's more!&lt;/p&gt;

&lt;p&gt;This article is already getting a little on the longer side. I know, I know... But here are some lessons I learned after this intense year of TypeScript:&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Take your time reading error messages
&lt;/h3&gt;

&lt;p&gt;TS error messages are really something. They can look aggressively verbose and distract you from the problem at hand.&lt;/p&gt;

&lt;p&gt;Try reading them bottom to top and make a solid effort to understand what is wrong before brute-forcing a solution (or giving up and leaving it &lt;code&gt;as any&lt;/code&gt;).&lt;/p&gt;

&lt;h3&gt;
  
  
  2. TS will infer a lot of stuff, get to know how it works
&lt;/h3&gt;

&lt;p&gt;You don't need to type every single line of your code. There's this thing called &lt;a href="https://www.typescriptlang.org/docs/handbook/type-inference.html" rel="noopener noreferrer"&gt;Type Inference&lt;/a&gt; where TS makes an educated guess about types considering information it.&lt;/p&gt;

&lt;p&gt;For instance, if you type an array, you won't need to type the argument of a filter or map function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;potatoes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;Array&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="kr"&gt;string&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;russet&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;yukon gold&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;la ratte&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="c1"&gt;// no need to type the potato arg below 👇&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;bestPotatoForMashedPotatoes&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;potatoes&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;potato&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;potato&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;la ratte&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;blockquote&gt;
&lt;p&gt;Unrelated cooking tip, La Ratte &lt;a href="https://www.youtube.com/watch?v=-mJYyueZfd8" rel="noopener noreferrer"&gt;is arguably the best potato&lt;/a&gt; for mashed potatoes.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3&gt;
  
  
  3. Always check for TypeScript support when adding a new dependency
&lt;/h3&gt;

&lt;p&gt;Most big libraries have either their type definitions contained in the same package you installed or under &lt;a href="https://github.com/DefinitelyTyped/DefinitelyTyped" rel="noopener noreferrer"&gt;DefinitelyTyped&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Make sure to always search for those type defs whenever you need them.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. The extra syntax pops up like a sore thumb in the beginning
&lt;/h3&gt;

&lt;p&gt;This is more of an attempt to bring you some comfort rather than an actual tip, but... Yeah, it is &lt;em&gt;a lot&lt;/em&gt; of new characters in your editor.&lt;/p&gt;

&lt;p&gt;It will look overwhelming for a couple of weeks, but you'll get used to it sooner than you think.&lt;/p&gt;

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

&lt;p&gt;I'd rather not &lt;em&gt;have to&lt;/em&gt; use TypeScript.&lt;/p&gt;

&lt;p&gt;It would be much easier to fling methods and variables left and right and hope for the best. Unfortunately, I lack the supernatural skill to always ship 100% bug-free code every time.&lt;/p&gt;

&lt;p&gt;TypeScript helps me ship better, more reliable work, and I'm glad it exists. Getting acquainted with it was no small feat, but I'm a better engineer today because of it.&lt;/p&gt;

&lt;p&gt;So yeah, give it a try if this article resonates with you. I hope it helped ease your TypeScriptoPhobia.&lt;/p&gt;

&lt;p&gt;You may not like in the beginning -- or at all -- but it is like eating bitter greens or exercising, you might not enjoy it, but it will be good for you.&lt;/p&gt;




&lt;p&gt;Photo by Andy Henderson on Unsplash&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>typescript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>9 Hiring Tips for Team Leads and Software Engineers</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Wed, 12 May 2021 11:19:07 +0000</pubDate>
      <link>https://dev.to/vtrpldn/9-hiring-tips-for-team-leads-and-software-engineers-5end</link>
      <guid>https://dev.to/vtrpldn/9-hiring-tips-for-team-leads-and-software-engineers-5end</guid>
      <description>&lt;p&gt;This week I realized that ever since my first full-time job as a frontend engineer I was somewhat involved or responsible for hiring new people.&lt;/p&gt;

&lt;p&gt;And I always found hiring... Strangely rewarding? I don't know. I have this weird predisposition to deal with work like it is some kind of strategy game. Hiring feels a lot like adding reinforcements to my XCOM squad.&lt;/p&gt;

&lt;p&gt;That being said, this hiring game is far from an easy one, and after many screened candidates, many mistakes, and zero formal HR training, I learned a lot of stuff that I'd love to share.&lt;/p&gt;

&lt;p&gt;Which brings us to this article, filled to the brim with advice for engineers (and team leads) that suddenly faced a need to add people to their team.&lt;/p&gt;

&lt;p&gt;Just keep in mind that while some of my learnings are actionable, some others are straight-up opinions, and both are direct consequences of my professional experience. So grab (and share!) what resonates with you and feel free to skip what you don't find applicable.&lt;/p&gt;

&lt;p&gt;Let us begin.&lt;/p&gt;

&lt;h2&gt;
  
  
  Treat candidates with the utmost respect and dignity
&lt;/h2&gt;

&lt;p&gt;Starting fast with rule freaking zero.&lt;/p&gt;

&lt;p&gt;It makes me mad that this needs to be said, but it does. No candidate should &lt;em&gt;ever&lt;/em&gt; be ignored; no candidate should &lt;em&gt;ever&lt;/em&gt; be left waiting weeks for a status update. That's basic human decency and the absolute minimum you can do when hiring people.&lt;/p&gt;

&lt;p&gt;Sorry for the rant, but I've seen friends being treated like crap far too many times. This kind of behaviour is &lt;em&gt;unacceptable&lt;/em&gt; and I wonder why it happens so often.&lt;/p&gt;

&lt;p&gt;One plausible theory I have is that recruiters (be it HR or engineers) usually fall into this hole where they can't notice the enormous asymmetry of the hiring process and treat people like mere tickets on aboard.&lt;/p&gt;

&lt;p&gt;See, as a recruiter, you go through dozens of profiles a day and disqualifying people is just part of the job. When you're finally done, you get a pat on the back, a "job well done", and move forward with other tasks.&lt;/p&gt;

&lt;p&gt;Applicants, on the other hand, have much more at stake. Not only because applying for a new job usually takes a significant amount of time, but also because a new job might mean a critical and long-waited career change, more money and safety, a breath of fresh air, a self-realization boost, and fresh, exciting challenges.&lt;/p&gt;

&lt;p&gt;Which does &lt;em&gt;not&lt;/em&gt; mean you should hire people "because they want that job so badly!!! 😩", but keeping that asymmetry in mind will help you stay empathetic and treat candidates with respect.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be super specific about what you want, what you can offer, and how you hire
&lt;/h2&gt;

&lt;p&gt;Hiring takes a lot of mental energy. Replying dozens of emails answering the same question about benefits and stipends over and over is not an intelligent use of that energy. So do yourself a favour and write a comprehensive job listing.&lt;/p&gt;

&lt;p&gt;Start with a &lt;em&gt;very&lt;/em&gt; detailed list of what does the company expects from the position. Think requirements, values, years of experience with XYZ, what the candidate can say or show to increase their chances, etc. Help them help you.&lt;/p&gt;

&lt;p&gt;And be as detailed, if not more, about what the company can offer as compensation for the role. Salary is a piece of obvious information that should be up top, and you should try and be as specific as you can, a hard number is ideal, but a salary range that accounts for experience works well enough. Don't forget benefits, PTO and sick-days policies, home-office budget, etc.&lt;/p&gt;

&lt;p&gt;Finally, do remember to add a section where you explain how the hiring process will be handled. A couple paragraphs describing each step and how long they usually take is enough to keep candidates informed. Being transparent is critical.&lt;/p&gt;

&lt;p&gt;And just like good engineers write new test cases after a newfound bug, make sure to update the job listing with extra info after a candidate emails you with a new question.&lt;/p&gt;

&lt;h2&gt;
  
  
  Have some kind of system where you can keep track of everything
&lt;/h2&gt;

&lt;p&gt;Sometimes, when I'm feeling a little bit optimistic, I think that recruiters ignore candidates not because they don't care but because they're terribly disorganized.&lt;/p&gt;

&lt;p&gt;I mean, that's somewhat understandable. It is easy to see how dealing with hundreds of candidates can be troublesome when you don't have a system to help you go through applications. However, trusting the task of keeping up with hundreds of people to your brain is hard to excuse.&lt;/p&gt;

&lt;p&gt;So whenever I have to deal with more than a pair of candidates, I create a Trello board or something similar, like a Google Sheet, to keep control of the process. I'm a fan of creating super-comprehensive pipelines where I can move people through each step so, for a standard hiring process, I'd have columns for:&lt;/p&gt;

&lt;p&gt;Application received &amp;gt; Application reviewed &amp;gt; First meeting invite sent &amp;gt; First meeting confirmed &amp;gt; Skill assessment sent &amp;gt; Skill assessment reviewed &amp;gt; Meeting with hiring manager invite sent &amp;gt; Meeting with hiring manager confirmed &amp;gt; Offer sent &amp;gt; Hired&lt;/p&gt;

&lt;p&gt;Your mileage may vary depending on how your recruiting process works, of course, but having a clear picture about every single candidate and where they are in the pipeline brings some much-needed peace of mind.&lt;/p&gt;

&lt;h2&gt;
  
  
  Create a checklist to help you filter our candidates objectively
&lt;/h2&gt;

&lt;p&gt;Success! You've promoted your job listing very well, some industry influencers even shared it on Twitter, and now you have eighteen hundred applications to sift through. Hooray!&lt;/p&gt;

&lt;p&gt;Ok, that number of applications is probably not realistic for the majority of job openings. But be it 1800 or 18, you might not have the time to book a 30-minute chat with &lt;em&gt;everyone&lt;/em&gt; that sends you an application. So you need a way to filter these candidates in a fast, fair and objective manner.&lt;/p&gt;

&lt;p&gt;That's where a checklist comes in handy, and if you wrote a detailed job listing, you're halfway there already.&lt;/p&gt;

&lt;p&gt;Start by gathering everything you wrote on the "what we expect from this position" and turn it into a checklist. Does this candidate have 5 years of experience with Node? ✅ Do they have prior leadership experience? ✅ Their past experiences are good evidence of seniority? ✅. And so on.&lt;/p&gt;

&lt;p&gt;Doing so provides an objective way to compare suitable applicants and gives you a fair (and quick) way to disqualify candidates that don't match the opening requirements. There is no problem with sending a "Thanks, but we expect more experience for candidates applying for this position" if you were transparent about what that amount of experience means.&lt;/p&gt;

&lt;h2&gt;
  
  
  Write down with a few canned, well-thought email templates
&lt;/h2&gt;

&lt;p&gt;Great hiring experiences happen when the people behind them are engaged and motivated to do it. So, as it happens in many situations in our industry, if you don't really feel like doing it, you'll do it half-assed.&lt;/p&gt;

&lt;p&gt;But don't take that as discouragement. I firmly believe that engineers should be the protagonists of hiring, and "not feeling like it" should be expected from time to time. Hiring is a communication-intensive process that can leave the best, most extrovert engineers feeling drained after a few hours.&lt;/p&gt;

&lt;p&gt;And what do we do when we don't want to work on a problem? We find a way to make that problem easier, more pleasurable to work with. And one thing that &lt;em&gt;really&lt;/em&gt; helps is emails templates.&lt;/p&gt;

&lt;p&gt;Let's go back to our hiring pipeline for a sec:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Application received &amp;gt; Application reviewed &amp;gt; First meeting invite sent &amp;gt; First meeting confirmed &amp;gt; Skill assessment sent &amp;gt; Skill assessment reviewed &amp;gt; Meeting with hiring manager invite sent &amp;gt; Meeting with hiring manager confirmed &amp;gt; Offer sent &amp;gt; Hired&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Imagine that you need to update candidates every time their status changes, be it progress or disqualification. Typing down:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Hello candidate,&lt;/p&gt;

&lt;p&gt;we are happy to invite you to the next step /&lt;br&gt;
unfortunately, we decided to not move forward with your application&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;for each step, for each candidate, gets old real quick. So do yourself a favour and write that email only once and use it as a template.&lt;/p&gt;

&lt;p&gt;Some pro HR tools like Recruitee gives you some fancy dynamic tags like [candidate_name] or [position_name], so you don't even need to worry about replacing strings. But even if you don't have those, simply copying and pasting a template (and remembering to change the candidate's name, for god's sake) will save you a lot of time.&lt;/p&gt;

&lt;p&gt;As a rule of thumb, it is good to have a positive (we're moving you to the next step) and a negative (unfortunately, we're not going forward) template for each stage of your pipeline. Just remember rule zero and write those messages with extra care and respect.&lt;/p&gt;

&lt;p&gt;Another good thing to keep in mind is that the longer you took to disqualify a candidate – say, they were dropped out on the last step before hiring – the more invested they were in the position. So take some extra time to write additional feedback for them.&lt;/p&gt;

&lt;p&gt;And even if you create a dozen templates, you'll still likely have to write some original replies for edge cases. Just make sure to update your job opening page with the information if it makes sense.&lt;/p&gt;

&lt;h2&gt;
  
  
  Don't let the ball on your court for long
&lt;/h2&gt;

&lt;p&gt;Long recruiting processes suck. Candidates get more anxious (and uninterested) by the week, recruiters get demoralized by slow progress, and sometimes the process takes so long that the open position starts to get questioned.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"If you need that extra person on your team so badly, why you're taking so long to find them, huh?"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Poor hiring decisions, however, also suck tremendously. And sometimes, the only way to prevent that is investing &lt;em&gt;a lot&lt;/em&gt; of time in assessing candidates.&lt;/p&gt;

&lt;p&gt;This sounds a lot like a no-win scenario, drag the process for too long and risk losing great candidates to other companies, rush like hell and risk adding a Python backend engineer to your React frontend team. Pretty much an HR &lt;a href="https://en.wikipedia.org/wiki/Kobayashi_Maru"&gt;Kobayashi Maru&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;You can do two things to deal with this impossible situation:&lt;/p&gt;

&lt;p&gt;Question your leadership (or yourself) about how long the hiring process should be. It is essential to have a "baseline" process that works most of the time, but sometimes you can speed up one step or two to make things go faster without significant negative impact.&lt;/p&gt;

&lt;p&gt;And if the process can't be made any faster, prevent it from going even slower.&lt;/p&gt;

&lt;p&gt;If you need to communicate an update to a candidate, do so immediately. If a candidate is unresponsive, check if they're still interested. If other people in the company need to take action, keep bugging that until they do something.&lt;/p&gt;

&lt;p&gt;No candidate should be left waiting because you're "like, super busy" with other tasks. An email takes like 2 minutes, even less if you already created some templates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Be aware of hiring biases
&lt;/h2&gt;

&lt;p&gt;Human beings are fascinating animals.&lt;/p&gt;

&lt;p&gt;We tend to look into the mirror and see clear-thinking, rational, fair individuals. But we are constant victims of cognitive biases that very much affect our decision-making without consent and, most of the time, without our awareness.&lt;/p&gt;

&lt;p&gt;If we don't stay alert of these biases, we might favour candidates for unfair reasons, like them being surprisingly good looking person, or their life stories being similar to ours.&lt;/p&gt;

&lt;p&gt;Another example, sometimes a friend or strong referral applies for the position. Instead of rationally assessing them and weighing pros and cons, we just search for information to confirm the initial assumption that they're a good candidate.&lt;/p&gt;

&lt;p&gt;For the sake of brevity – and the already mentioned lack of formal psychology &amp;amp; HR education – this section won't feature a list of biases, only a &lt;em&gt;strong recommendation&lt;/em&gt; for you to research more about it on reputable sources. Doing so will help you hire better and give you insights into some unconscious decisions you make every day.&lt;/p&gt;

&lt;p&gt;Another thing to keep in mind, and this is a suggestion I'm comfortable with making, try and have at least one more person with you when evaluating CVs and during meetings with candidates.&lt;/p&gt;

&lt;p&gt;It doesn't have to be the same colleague pairing with you every time. Just having one more person sharing their thoughts about a candidate is a powerful tool to help both of you recognize and counter biases.&lt;/p&gt;

&lt;h2&gt;
  
  
  Take action
&lt;/h2&gt;

&lt;p&gt;A few years ago, I found myself in this unusual scenario where three engineers, out of five, left my team in the same month. Each of them had good reasons to do so, and I was happy that they could find new challenges.&lt;/p&gt;

&lt;p&gt;One thing I was &lt;em&gt;not&lt;/em&gt; pleased about, though, is that my then team had some optimistic goals that were no longer attainable with two people instead of five. And to make things worse, the HR dept was notoriously slow and unresponsive. Some teams usually had to wait for months to meet with a promising candidate, things we're not looking good.&lt;/p&gt;

&lt;p&gt;Thankfully (or, should I say, &lt;em&gt;at least&lt;/em&gt;), the company had a strong ownership and autonomy culture, so I convinced myself that by jumping over HR and handling recruiting all by myself, I'd be 100% aligned to the company expectations.&lt;/p&gt;

&lt;p&gt;And that's what I did. I still had a talk about compensation and benefits with HR – as a mere Team Lead, I didn't have &lt;em&gt;that&lt;/em&gt; level of autonomy. Still, our agreement was that I would pick the candidates, and they would just work the final bureaucracy of hiring contracts, background checks and so on.&lt;/p&gt;

&lt;p&gt;So for a couple of weeks, I didn't write a single &lt;code&gt;console.log&lt;/code&gt; and devoted my time to writing job opening pages, headhunting, screening candidates, assessing tech skills, and doing all the communication.&lt;/p&gt;

&lt;p&gt;During that period, I went through HR material like I was reading the docs of a fascinating new framework. Whenever I was conflicted with a decision or unsure about how to proceed, there was good advice on the internet. Hiring is not rocket science.&lt;/p&gt;

&lt;p&gt;And things went surprisingly well! We hired three competent junior engineers with great cultural fit and still got to meet the quarter goals. I still catch myself wondering how we did it and feel content to have grabbed that bull but the horns.&lt;/p&gt;

&lt;p&gt;So yeah, if there's a moral to this anecdote, it is that sometimes the only way you can put a fire down is by dropping the firehose and finding some more firefighters to team up with.&lt;/p&gt;

&lt;h2&gt;
  
  
  Remember that there's more to a good engineer than raw coding skills
&lt;/h2&gt;

&lt;p&gt;Filtering candidates is a big, if not the most significant, part of recruiting. You want people to help you on a mission, and you want to pick the best among all applicants.&lt;/p&gt;

&lt;p&gt;What makes the "best" candidate varies a lot, though. Being super good with this week's stack is an obvious thing to notice, sure, but there are still many subtle and equally important skills to consider before deciding and who you'll hire.&lt;/p&gt;

&lt;p&gt;For instance, try and picture a talented engineer that can't communicate their thoughts clearly, either written or verbally. Or a super fast designer that works fantastically under supervision but lacks the self-motivation to keep pushing when no one is watching.&lt;/p&gt;

&lt;p&gt;Doing great work nowadays requires a diverse skill-set, especially if we consider the remote work boom. You need people that: can work under little to no supervision, self-organize over a clear mission, collaborate well while being precise with their words, manages their time efficiently, and display strong emotional intelligence.&lt;/p&gt;

&lt;p&gt;Which can be... Hard to find, yeah, but just like a person can be a junior in tech skills, you can expect them to be inexperienced with these so-called "soft skills". This is fine, a good manager/team lead should develop soft skills as much as they promote tech expertise among the team.&lt;/p&gt;

&lt;p&gt;Just keep in mind that values like integrity, honesty, and respect are not negotiable and should be expected from the greenest intern to the most seasoned veteran.&lt;/p&gt;

&lt;h2&gt;
  
  
  Wrapping it all up
&lt;/h2&gt;

&lt;p&gt;I'm quite confident that you'll go from unstructured, chaotic hiring to a pretty darn good process by following these tips. Most of it might sound like straight-up common sense to experienced people, but trust me, the "me from the past" would've love to be taught some of those things.&lt;/p&gt;

&lt;p&gt;And with that in mind, I'm 100% sure that I still have a lot to learn about it. I mean, hiring is a complex process with a lot of variation and moving parts, and everything I know is "derived from" and "limited to" my career as a frontend engineer.&lt;/p&gt;

&lt;p&gt;For future reference, I have this (very well recommended) book on my reading list called "Scaling Teams" from Alexander and David Loftesness. I should be going through it shortly, so you can expect either a quick revision of this article or a new "lesson learned" article about it.&lt;/p&gt;

&lt;p&gt;Stay tuned and until next time. 👋&lt;/p&gt;




&lt;p&gt;Photo by Christina @ wocintechchat.com on Unsplash.&lt;/p&gt;

&lt;h3&gt;
  
  
  Hey, let's connect 👋
&lt;/h3&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>career</category>
      <category>hiring</category>
      <category>management</category>
    </item>
    <item>
      <title>Responsive Snakes! And what they can teach you about CSS 🐍</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Wed, 18 Nov 2020 14:44:58 +0000</pubDate>
      <link>https://dev.to/vtrpldn/responsive-snakes-and-what-they-can-teach-us-about-css-1o02</link>
      <guid>https://dev.to/vtrpldn/responsive-snakes-and-what-they-can-teach-us-about-css-1o02</guid>
      <description>&lt;p&gt;"If a snake was responsive..." is my favorite webdev meme. Have a look below if you're not familiar with this &lt;em&gt;extremely important&lt;/em&gt; question.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9cszx8chv7k5yhz4bvql.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9cszx8chv7k5yhz4bvql.png" alt="If a snake was responsive..."&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I love it, it is &lt;em&gt;so&lt;/em&gt; silly. But at the same time makes us think a little deeper about responsive design and CSS techniques.&lt;/p&gt;

&lt;p&gt;And that's what this article is about! Let's talk about four &lt;strong&gt;responsive snake&lt;/strong&gt; implementations, see how they were made and what they can teach us.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;🚨 There's a CodeSandbox for you to play with at the end &lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Squishy Snake
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fot4cfhazr84l31nvdofc.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fot4cfhazr84l31nvdofc.gif" alt="Squishy Snake"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Squishy Snake is the most basic of our responsive snakes. It uses no media queries at all!&lt;/p&gt;

&lt;p&gt;Like all the other snakes, it is made by 3 divs: &lt;code&gt;.tail&lt;/code&gt;, &lt;code&gt;.body,&lt;/code&gt; and &lt;code&gt;.head&lt;/code&gt;. And a wrapper, in this case, &lt;code&gt;.snake-1&lt;/code&gt;.&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;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"snake-1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"tail"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"body"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"head"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There is quite a lot of CSS responsible for &lt;em&gt;drawing&lt;/em&gt; the snake itself. But let's focus only on the rules that make it responsive.&lt;/p&gt;

&lt;p&gt;In this first case, I wrote CSS rules that say that the tail width should always be 200 pixels long, that the head should be 100 pixels long, and that the body should fill the rest.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-1&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.tail&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;200px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.head&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;100px&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;p&gt;You can apply the same technique in real life when your page needs two sidebars and some middle content that should fill the space in between!&lt;/p&gt;

&lt;p&gt;Thank you, Squishy Snake 🐍. Next!&lt;/p&gt;

&lt;h2&gt;
  
  
  Curved Snake
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fojgrji9jrd1vvi5ywd1a.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fojgrji9jrd1vvi5ywd1a.gif" alt="Curved Snake"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Curved Snake shares the same HTML structure and some CSS, but things get &lt;em&gt;funky&lt;/em&gt; when the screen goes short!&lt;/p&gt;

&lt;p&gt;The first thing we do is flip the flex order, so instead of horizontal, each snake part is rendered vertically.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-2&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;flex-direction&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;column&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;62vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&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;p&gt;Now that &lt;code&gt;flex-direction&lt;/code&gt; is vertical, we need to update our snake parts so that they have a fixed &lt;code&gt;height&lt;/code&gt; instead of &lt;code&gt;width&lt;/code&gt;.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-2&lt;/span&gt; &lt;span class="nc"&gt;.tail&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.snake-2&lt;/span&gt; &lt;span class="nc"&gt;.body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.snake-2&lt;/span&gt; &lt;span class="nc"&gt;.head&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&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;p&gt;And finally, we link the tail, body, and head with some extra pseudo-elements. These are the green vertical parts that only exist when the screen collapses.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-2&lt;/span&gt;&lt;span class="nd"&gt;::before&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nc"&gt;.snake-2&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s2"&gt;''&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30vh&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;15px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;30px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.snake-2&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&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;p&gt;Now for the &lt;strong&gt;real-life takeaway&lt;/strong&gt;: &lt;/p&gt;

&lt;p&gt;Changing &lt;code&gt;flex-direction&lt;/code&gt; to &lt;code&gt;vertical&lt;/code&gt; is a life-saver when you're doing responsive pages.&lt;/p&gt;

&lt;p&gt;Just stay aware that &lt;code&gt;flex-direction: column&lt;/code&gt; inverts how divs flow inside a flex container, so &lt;code&gt;justify-content&lt;/code&gt; becomes vertical and &lt;code&gt;align-items&lt;/code&gt; horizontal!&lt;/p&gt;

&lt;p&gt;Thanks, Curved Snake 🐍. Onto the next one!&lt;/p&gt;

&lt;h2&gt;
  
  
  Sliced Snake
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk9tpe7f6ta8dpbnvby86.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fk9tpe7f6ta8dpbnvby86.gif" alt="Sliced Snake"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sliced Snake is pretty much Curved Snake &lt;strong&gt;without&lt;/strong&gt; the &lt;code&gt;::before&lt;/code&gt; and &lt;code&gt;::after&lt;/code&gt; pseudo-elements.&lt;/p&gt;

&lt;p&gt;The other difference is that this one doesn't look so lively.&lt;/p&gt;

&lt;p&gt;See, the snake eyes are also pseudo-elements (see the CodeSandbox below). So in order to change its eye, all I needed to do was write this handful of CSS:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-3&lt;/span&gt; &lt;span class="nc"&gt;.head&lt;/span&gt;&lt;span class="nd"&gt;::before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"✖"&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;p&gt;Real-life takeaway: If you slice a snake it dies. Don't try dealing with snakes yourself, call your local environmental protection agency! &lt;/p&gt;

&lt;p&gt;Thanks, Sliced Snake, you will not be forgotten.&lt;/p&gt;

&lt;p&gt;Next!&lt;/p&gt;

&lt;h2&gt;
  
  
  Scrolly Snake
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6yag645mn094nneocyd5.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F6yag645mn094nneocyd5.gif" alt="Scrolly"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I love Scrolly Snake. This one is the absolute laziest take on a responsive snake.&lt;/p&gt;

&lt;p&gt;Instead of allowing it to overflow off-screen, simply add some &lt;code&gt;width&lt;/code&gt; and &lt;code&gt;overflow-w: scroll&lt;/code&gt; to it and you're done.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.snake-4&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;70%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow-x&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;scroll&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;p&gt;Now, despite Scrolly Snake looking like a really lazy attempt to responsiveness, it teaches us a great lesson:&lt;/p&gt;

&lt;p&gt;There are some times that &lt;code&gt;overflow: scroll&lt;/code&gt; is the only solution for a responsive problem. &lt;/p&gt;

&lt;p&gt;For instance, imagine that you have a huge table full of columns and need to make it responsive, or a super long string that can't be wrapped. &lt;/p&gt;

&lt;p&gt;It is important to know all the tools that you have at hand!&lt;/p&gt;

&lt;h2&gt;
  
  
  CodeSnakebox
&lt;/h2&gt;

&lt;p&gt;Try editing/playing/breaking the examples below:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/yo40p"&gt;
&lt;/iframe&gt;
&lt;/p&gt;




&lt;p&gt;Thanks for reading! Can you think of another way to make a snake responsive?&lt;/p&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev" rel="noopener noreferrer"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
      <category>codenewbie</category>
    </item>
    <item>
      <title>Make Your CSS Dynamic 🕺 With Styled Components</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Mon, 16 Nov 2020 15:29:20 +0000</pubDate>
      <link>https://dev.to/vtrpldn/styled-components-dealing-with-dynamic-styling-1ja3</link>
      <guid>https://dev.to/vtrpldn/styled-components-dealing-with-dynamic-styling-1ja3</guid>
      <description>&lt;p&gt;&lt;code&gt;styled-components&lt;/code&gt; helps you write better CSS in React. It does so by allowing you to wrap all your component's styles into a neat, style-only component. &lt;/p&gt;

&lt;p&gt;So, instead of this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.wrapper&lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;font-family&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;sans-serif&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.button&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#2b2b2b&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;white&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&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;p&gt;and this&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="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="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./styles.css&lt;/span&gt;&lt;span class="dl"&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Wrapper"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt; &lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"Button"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, I am a Button&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;div&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&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;p&gt;&lt;strong&gt;You have something like that:&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="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;styled&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;styled-components&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;Wrapper&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="s2"&gt;`
  font-family: sans-serif;
`&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;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background: #2b2b2b;
  color: white;
  font-size: 24px;
  padding: 12px;
  cursor: pointer;
`&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="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, I am a Button&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&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;p&gt;Which might not look like a big change. I know, I know! It looks like all that we did here was merge two files into a single one...&lt;/p&gt;

&lt;p&gt;However, by doing so we integrated our styles &lt;em&gt;into&lt;/em&gt; &lt;code&gt;styled-components&lt;/code&gt; and now that the library controls our CSS it can do all kinds of cool stuff like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Automatic inject critical CSS&lt;/li&gt;
&lt;li&gt;Automatic vendor prefixing&lt;/li&gt;
&lt;li&gt;Theming and dynamic styling&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This saves us a lot of time and allows us to focus on important stuff like adding borders to buttons and stuff like that.&lt;/p&gt;

&lt;p&gt;Now, after this brief introduction to the wonders of &lt;code&gt;styled-components&lt;/code&gt;, let's focus on the dynamic styling part.&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic styling with &lt;code&gt;styled-components&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;The point of dynamic styling is saving time and writing less CSS. &lt;/p&gt;

&lt;p&gt;Imagine that you have a &lt;strong&gt;primary&lt;/strong&gt; and a &lt;strong&gt;secondary&lt;/strong&gt; button. They are very similar, but you want your primary button to have a flashy color so people actually click on it.&lt;/p&gt;

&lt;p&gt;You can do that by adding a &lt;code&gt;primary&lt;/code&gt; attribute to your &lt;code&gt;&amp;lt;Button /&amp;gt;&lt;/code&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="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;App&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="p"&gt;(&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, I am a Button&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt; &lt;span class="na"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;Hello, I am a Primary Button&lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="p"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nc"&gt;Wrapper&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&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;p&gt;...and handling that new attribute on your styled component, exactly like you would with component props!&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#6495ED&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#2b2b2b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
  color: white;
  font-size: 24px;
  padding: 12px;
  cursor: pointer;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  "But what if my component needs a lot of customization?"
&lt;/h3&gt;

&lt;p&gt;It may happen that your buttons need to be extra flexible, while still sharing some basic styles. Maybe you need to have a &lt;strong&gt;primary&lt;/strong&gt; button that also has &lt;strong&gt;rounded corners&lt;/strong&gt; and a fancy &lt;strong&gt;box-shadow&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;You can do that by applying the same logic as the earlier example. But that can get quite repetitive, look:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="s2"&gt;`
  background: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#6495ED&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#2b2b2b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
  border-radius: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;round&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
  box-shadow: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;props&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;props&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shadow&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2px 2px 2px rgba(0, 0, 0, 0.5)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
  color: white;
  font-size: 24px;
  padding: 12px;
  cursor: pointer;
`&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What you can do here instead is "lift" the props and do something like that:&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;styled&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
  &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;primary&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;round&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;shadow&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="s2"&gt;`
    background: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;primary&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#6495ED&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;#2b2b2b&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
    border-radius: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;round&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;4px&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;0&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
    box-shadow: &lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;shadow&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;2px 2px 2px rgba(0, 0, 0, 0.5)&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;none&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;;
    color: white;
    font-size: 24px;
    padding: 12px;
    cursor: pointer;
  `&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;That way, instead of "importing" each prop on a per-line basis, you do it at the very beginning of your styles, so you can be 100% sure of what makes it dynamic!&lt;/p&gt;

&lt;p&gt;Just keep in mind that while this technique is cool and makes your styled components look leaner, needing extensive customization might be a sign of bad abstraction. &lt;/p&gt;

&lt;p&gt;So before adding a fourth (or fifth) dynamic style rule, make sure that you shouldn't really be creating a new styled component!&lt;/p&gt;




&lt;p&gt;And this is it for the day. Thanks for reading!&lt;/p&gt;

&lt;p&gt;I wrote this article (at the eleventh hour) for &lt;a href="https://hashnode.com/bootcamp/batch-2"&gt;Hashnode Bootcamp II&lt;/a&gt; first assignment.&lt;/p&gt;

&lt;p&gt;Make sure to check all the other Bootcamp articles and &lt;a href="https://twitter.com/paladini_dev"&gt;follow me on Twitter&lt;/a&gt;!&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Simple Chrome Extensions That Make My Work a Bit Easier</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Fri, 06 Nov 2020 13:57:14 +0000</pubDate>
      <link>https://dev.to/vtrpldn/simple-chrome-extensions-that-make-my-work-a-bit-easier-421b</link>
      <guid>https://dev.to/vtrpldn/simple-chrome-extensions-that-make-my-work-a-bit-easier-421b</guid>
      <description>&lt;p&gt;No time for introductions! &lt;/p&gt;

&lt;p&gt;I've been front-end-ing for a while. &lt;/p&gt;

&lt;p&gt;Here are some of the extensions that helped me along the way. &lt;/p&gt;

&lt;p&gt;Links on the title.&lt;/p&gt;

&lt;p&gt;Let's go! 🏃‍♀️🏃‍♂️💨&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/pesticide-for-chrome-with/neonnmencpneifkhlmhmfhfiklgjmloi" rel="noopener noreferrer"&gt;Pesticide&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flqloqde6l012epn7zct1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Flqloqde6l012epn7zct1.png" alt="Pesticide"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Pesticide is great for debugging invisible stuff in CSS. I'm talking margins, padding, and everything that fills some space but you can't quite know where it begins and ends.&lt;/p&gt;

&lt;p&gt;The extension couldn't be simpler, really. It works by applying 1px borders to every element on the page, look.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqx8d8q7xqk3b5kp32g0z.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fqx8d8q7xqk3b5kp32g0z.gif" alt="Pesticide example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/live-css-editor/oelggcmknbjmhkpgjfhakedcfnkgbdpg" rel="noopener noreferrer"&gt;Live CSS Editor&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F83k3jwnzyh5wdz8zdh36.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F83k3jwnzyh5wdz8zdh36.png" alt="Live CSS Editor"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Live CSS Editor, as the name suggests, allows you to add some CSS to every page through a neat little box. It is great for debugging and testing a small style real quick without opening DevTools.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsiqvk7q6s83u5hg4dm88.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fsiqvk7q6s83u5hg4dm88.gif" alt="Live CSS Editor"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/perfectpixel-by-welldonec/dkaagdgjmgdmbnecmcefdhjekcoceebi?hl=en" rel="noopener noreferrer"&gt;PerfectPixel&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjmmbx7evxfaxo9mnv0lk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fjmmbx7evxfaxo9mnv0lk.png" alt="PerfectPixel"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;PerfectPixel is particularly practical when you need to perfectly place pixels on your page. &lt;/p&gt;

&lt;p&gt;But seriously, though. There is no better tool for when your implementation needs to look ridiculously close to the layout. &lt;/p&gt;

&lt;p&gt;Just paste a semi-transparent &lt;code&gt;.jpg&lt;/code&gt; over your screen and tweak your CSS until it matches.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdg8kspihqo9hsimgcbci.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fdg8kspihqo9hsimgcbci.gif" alt="PerfectPixel example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/colorzilla/bhlhnicpbhignbdhedgjhgdocnmhomnp?hl=en" rel="noopener noreferrer"&gt;ColorZilla&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9k4i0xc7tyulwofhrh77.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9k4i0xc7tyulwofhrh77.png" alt="ColorZilla"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Sometimes you just need to pick a color. &lt;/p&gt;

&lt;p&gt;ColorZilla is the best color picker for your color picking needs.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxqx0nekaiz386hxqhz3p.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fxqx0nekaiz386hxqhz3p.gif" alt="ColorZilla example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/change-timezone-time-shif/nbofeaabhknfdcpoddmfckpokmncimpj?hl=en" rel="noopener noreferrer"&gt;TimeShift&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5z1d291ujtpwudlc3c5d.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F5z1d291ujtpwudlc3c5d.png" alt="TimeShift"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If your product needs to support multiple timezones you might know already that working with timezones is a one-way ticket to Frustration Town.&lt;/p&gt;

&lt;p&gt;This extension won't solve your problems but it makes the timezone debugging experience &lt;em&gt;slightly&lt;/em&gt; less sad by allowing you to fake your browser's current timezone.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9jby1r2piojndhmyysy1.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F9jby1r2piojndhmyysy1.gif" alt="TimeShift example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;a href="https://chrome.google.com/webstore/detail/gofullpage-full-page-scre/fdpohaocaechififmbbbbbknoalclacl?hl=en" rel="noopener noreferrer"&gt;GoFullPage&lt;/a&gt;
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8u69meggfog9f2lb0jqh.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F8u69meggfog9f2lb0jqh.png" alt="GoFullPage"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You need to share your progress and you need to share it quickly.&lt;/p&gt;

&lt;p&gt;But Chrome, for some unknown reason, doesn't offer you a native way to screenshot the whole page.&lt;/p&gt;

&lt;p&gt;This extension fixes that problem.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh4i46ku3wks3vbqkzem8.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fh4i46ku3wks3vbqkzem8.gif" alt="GoFullPage example"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;Thanks for reading! Hope any of these extensions make your work slightly easier.&lt;/p&gt;

&lt;p&gt;This week got my super anxious and unproductive so I rushed this article last minute to keep my streak. I need to &lt;a href="https://dev.to/vtrpldn/i-got-the-16-week-streak-badge-here-s-everything-i-learned-about-consistency-2nna#3-be-ok-with-publishing-imperfect-work"&gt;practice what I preach, after all&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I also might have drank way too much coffee this morning. &lt;/p&gt;

&lt;p&gt;Anyway! &lt;a href="https://twitter.com/paladini_dev" rel="noopener noreferrer"&gt;Follow me on Twitter&lt;/a&gt;, leave your suggestions in the comments. Have a good weekend! 😄&lt;/p&gt;

&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@heftiba?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Toa Heftiba&lt;/a&gt; Unsplash&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>css</category>
      <category>hhtml</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Is there a designated place to chat with members of the DEV Community?</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Fri, 30 Oct 2020 19:25:38 +0000</pubDate>
      <link>https://dev.to/vtrpldn/is-there-a-designated-place-to-chat-with-members-of-the-dev-community-23o8</link>
      <guid>https://dev.to/vtrpldn/is-there-a-designated-place-to-chat-with-members-of-the-dev-community-23o8</guid>
      <description>&lt;p&gt;I miss a place where we can chat, share tips, and build stronger bonds. Is there a Discord server that people around here use or something similar?&lt;/p&gt;

&lt;p&gt;I'm aware of DEV Connect but never really understood how it works. 😅&lt;/p&gt;

</description>
      <category>watercooler</category>
      <category>meta</category>
    </item>
    <item>
      <title>Grab your user's attention with the :focus-within CSS selector</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Fri, 30 Oct 2020 11:52:10 +0000</pubDate>
      <link>https://dev.to/vtrpldn/grab-your-user-s-attention-with-the-focus-within-css-selector-4d4</link>
      <guid>https://dev.to/vtrpldn/grab-your-user-s-attention-with-the-focus-within-css-selector-4d4</guid>
      <description>&lt;p&gt;Here's a neat little trick:&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;:focus-within&lt;/code&gt; selector to style the parent of a focused element.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0lja1zmk1zynjzdkr7d7.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2F0lja1zmk1zynjzdkr7d7.gif" alt="An example of how on focus overlay works"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That allows you to create some interactive form UI without a single line of JavaScript. Try the example below:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/ubhp7"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This demo uses &lt;code&gt;:focus-within&lt;/code&gt;, plus the &lt;code&gt;::before&lt;/code&gt; pseudo-selector and some absolute positioning magic. We'll go through the details but you can check the full source below.&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/ubhp7?view=editor"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;code&gt;:focus-within&lt;/code&gt; selector + &lt;code&gt;::before&lt;/code&gt; pseudo-elements + absolute positioning
&lt;/h2&gt;

&lt;p&gt;All in a single declaration block! Let's have a look at the most important part of this example.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;body&lt;/span&gt;&lt;span class="nd"&gt;:focus-within::before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;""&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0.7&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;h3&gt;
  
  
  &lt;code&gt;body:focus-within&lt;/code&gt;
&lt;/h3&gt;

&lt;p&gt;This selector will apply styles whenever there is &lt;strong&gt;focus&lt;/strong&gt;... &lt;strong&gt;within&lt;/strong&gt; the body!&lt;/p&gt;

&lt;p&gt;Oh, and &lt;code&gt;:focus-within&lt;/code&gt; works with any element. We're sticking with &lt;code&gt;body&lt;/code&gt; only for this example. &lt;/p&gt;

&lt;p&gt;You can be creative and come up with &lt;code&gt;.literallyAnyElement:focus-within&lt;/code&gt; and use this selector as you please.&lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;code&gt;body:focus-within::before&lt;/code&gt; + absolute positioning
&lt;/h3&gt;

&lt;p&gt;In our example, that means that whenever any field is focused on the body, a &lt;code&gt;::before&lt;/code&gt; pseudo-element will be created with those styles:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;content&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;""&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;position&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;absolute&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;top&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;left&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="nt"&gt;width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%;&lt;/span&gt;
&lt;span class="nt"&gt;height&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="err"&gt;100&lt;/span&gt;&lt;span class="o"&gt;%;&lt;/span&gt;
&lt;span class="nt"&gt;background-color&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="nt"&gt;rgba&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="err"&gt;0&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="err"&gt;7&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;content: ''&lt;/code&gt; property is required for pseudo-elements and everything else are properties used to create a dark, transparent overlay that fills the whole screen!&lt;/p&gt;

&lt;h3&gt;
  
  
  Extra stuff to make it work properly
&lt;/h3&gt;

&lt;p&gt;Keep in mind that you still need to make a couple of tweaks to make the overlay work perfectly.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
&lt;span class="nt"&gt;body&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100vh&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;p&gt;This makes sure that the overlay fills the whole screen even if there isn't enough content on the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;form&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
 &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This &lt;code&gt;position: relative;&lt;/code&gt; ensures that the overlay renders below the form.&lt;/p&gt;




&lt;p&gt;And that's it for this week's neat little trick. Thanks for reading!&lt;/p&gt;

&lt;p&gt;Make sure the check the other tricks in the series and &lt;a href="https://twitter.com/paladini_dev" rel="noopener noreferrer"&gt;follow me on Twitter&lt;/a&gt; if you found any of my articles helpful 😄&lt;/p&gt;




&lt;p&gt;EDIT: Make sure to check Andrew's suggestion in the comments below!&lt;/p&gt;




&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@stefanbc" rel="noopener noreferrer"&gt;Stefan Cosma&lt;/a&gt; on Unsplash&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How I Manage Impostor Syndrome, Fear of Failure, and Other Common Programmer Problems</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Fri, 23 Oct 2020 12:04:29 +0000</pubDate>
      <link>https://dev.to/vtrpldn/how-i-manage-impostor-syndrome-fear-of-failure-and-other-common-programmer-problems-3nk6</link>
      <guid>https://dev.to/vtrpldn/how-i-manage-impostor-syndrome-fear-of-failure-and-other-common-programmer-problems-3nk6</guid>
      <description>&lt;p&gt;Sometimes your own bugs are much harder to fix.&lt;/p&gt;

&lt;p&gt;One thing that I noticed after all those years in the industry is that mastering the tech is only half of the battle. You know, being fluent in JavaScript isn't worth much if you are paralyzed by fear of failure and never step out of your programming cave.&lt;/p&gt;

&lt;p&gt;However, some other thing I also realized is that with a little bit of work and self-reflection you can handle the inner side of programming just like you handle your codebase. &lt;/p&gt;

&lt;p&gt;You just need to &lt;strong&gt;approach these issues like optimization opportunities instead of bugs to fix&lt;/strong&gt; once and for all. &lt;/p&gt;

&lt;p&gt;So let's talk about how to deal with those kinds of issues. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Check out this neat table of contents:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Impostor syndrome&lt;/li&gt;
&lt;li&gt;Dealing with failure&lt;/li&gt;
&lt;li&gt;Comparing yourself to others&lt;/li&gt;
&lt;li&gt;"There's too much to learn"&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Impostor syndrome 😥
&lt;/h2&gt;

&lt;p&gt;I had plenty of episodes of impostor syndrome in my career, the biggest one was when I accepted my first leadership position at a big payment company.&lt;/p&gt;

&lt;p&gt;See, I had some tech lead experience under my shoulders already but never at a &lt;em&gt;big&lt;/em&gt; company, my previous leadership role was more a matter of necessity than hierarchy. And to make things worse, a was a complete newbie in the payment industry. &lt;/p&gt;

&lt;p&gt;So, for the first time ever, I was a tech lead among other tech leads, and all of them looked so much smarter and capable than me. I'll tell you, my friend, I felt like a fraud. &lt;/p&gt;

&lt;p&gt;"What the hell am I even doing here?" was a common thought.&lt;/p&gt;

&lt;p&gt;Fortunately, during that time, I found a few pieces of advice that helped me shake off that feeling. Nowadays, whenever insecurity strikes, I make a conscient effort to &lt;strong&gt;remind myself of these tips&lt;/strong&gt;, it helps a lot.&lt;/p&gt;

&lt;p&gt;Here they are:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The people that hired you are not stupid.&lt;/strong&gt; Seriously, they would not have hired you if they didn't think you were capable of doing the job. Hiring good people is literally their job description. They probably even picked you among a handful of other very good people. You're good.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;You're not a manipulative mastermind.&lt;/strong&gt; Fooling people is hard work. Your coworkers are aware of your flaws, it's okay. They are also full of them and can be more supportive than you imagine.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Help people.&lt;/strong&gt; Helping people instantly stave off impostor feelings. By being helpful you are able to see instantly how what you know can make people's life easier. It is a very rewarding feeling.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Use social media wisely.&lt;/strong&gt; It is a petty feeling, but nothing triggers my impostor syndrome so much like scrolling through twenty tweets of people doing an amazing job in this industry. It makes me feel like "how can they even do all of it?".&lt;/p&gt;

&lt;p&gt;One thing that helps (other than quitting Twitter for a couple of hours) is following people that are still learning and can benefit from your insights. &lt;/p&gt;

&lt;p&gt;What I'm trying to say here is, by all means, follow the masters, but also follow some newbies. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not being the smartest person in the room is actually a very good thing&lt;/strong&gt;. Try to see the knowledge gap between you and your peers not as a flaw but as learning potential. We all learn from each others experience and it is a privilege to work with people that can teach you a lot.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Know what you don't know.&lt;/strong&gt; Sometimes the impostor syndrome hits and it feels like you don't know shit. When it happens, try and make a &lt;em&gt;realistic list&lt;/em&gt; of everything you should learn to stop feeling like an impostor and compare it with everything that you know already. &lt;/p&gt;

&lt;p&gt;This exercise gives you clarity and, even if you still feel like an impostor, you'll find a new focus to learn what you should learn.&lt;/p&gt;




&lt;h2&gt;
  
  
  Dealing with failure 👎
&lt;/h2&gt;

&lt;p&gt;I hate failing. &lt;/p&gt;

&lt;p&gt;Not up to a point of stopping me from embarking on new, bold endeavors but, truth be told, &lt;strong&gt;failing fucking sucks&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I see a lot of advice around the internet like "you should love to fail, yadda-yadda" but, let's be honest for a moment, if it didn't hurt when you failed it means you didn't put enough effort. &lt;/p&gt;

&lt;p&gt;You'd need to be an ultimate-zen-monk-master-of-emotional-intelligence to not feel bad after giving your absolute best and failing. It's natural, feel free to hate failing, hate it with passion. 😡&lt;/p&gt;

&lt;p&gt;But learn to love feedback and the lessons that each failure teaches you. 😌&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Be humble and accept your responsibility for the failure.&lt;/strong&gt; This is the first step, the only way to learn from your failures is to own your mistakes and find a way to prevent them in the future. &lt;/p&gt;

&lt;p&gt;However… &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://www.youtube.com/watch?v=1TCX90yALsI"&gt;You can do everything right and still fail&lt;/a&gt;.&lt;/strong&gt; You can be the perfect candidate, master all the algorithms, and ace the whiteboard interview, only for the company to hire a friend of the CTO. Life is an unpredictable crazy ride that's far from fair. Understanding it makes some failures easier to swallow. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Understand that every failure teaches you something.&lt;/strong&gt; Give yourself some time to think about a failure. Try to write down what you could've done differently. Heck, write a damn incident report about your failure as a blog post, sharing what you learned through failure is a big act of generosity.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Failing is better than "what if-ing".&lt;/strong&gt; I've failed quite a lot during these years and I can say that the pain of failing fades much quicker than the bitter taste of "I should have at least tried it...".&lt;/p&gt;




&lt;h2&gt;
  
  
  Comparing yourself to others 👀
&lt;/h2&gt;

&lt;p&gt;This one is a cousin of impostor syndrome and a bad habit I'm particularly guilty of. &lt;/p&gt;

&lt;p&gt;There are a lot of brilliant, talented people in this industry and I'm grateful for their contributions. Prolific programmers make my life so much easier! &lt;/p&gt;

&lt;p&gt;Sometimes, however, it gets hard to shake off the &lt;strong&gt;"this person is 10 years younger and much more successful than I'll ever be"&lt;/strong&gt; feeling.&lt;/p&gt;

&lt;p&gt;Whenever I feel that way I try to remind myself of a few things:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Am I doing my best to make progress without harming my mental health?&lt;/strong&gt; Every person has their own limit. Working 80 hour weeks while maintaining 16 open source repositories might make a person's career skyrocket, but at what cost?&lt;/p&gt;

&lt;p&gt;It is much better to make consistent progress at a slower rate than wreck your health trying to maintain a rhythm that is not your own.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hard work pays off, but luck plays a huge role.&lt;/strong&gt; And I'm not the one saying it. Here's a very interesting article from &lt;a href="https://blogs.scientificamerican.com/beautiful-minds/the-role-of-luck-in-life-success-is-far-greater-than-we-realized/"&gt;Scientific American on the matter&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;Try remembering that next time you find yourself comparing your work to another person's. You'll never be able to know for certain because–sorry for being repetitive here–life is an unpredictable crazy ride, but it could have been luck. Plain simple luck.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Everyone has their own set of personal challenges and privileges.&lt;/strong&gt; One final reason to put you back on track when this kind of thought pops in: it is a whole different race for everyone. No other person had the same start nor has the same finish line. Stay focused on your lane and strive for greatness at your own speed.&lt;/p&gt;




&lt;h2&gt;
  
  
  "There's too much to learn" 😫📚
&lt;/h2&gt;

&lt;p&gt;I was lucky to start working exactly when Flash was being discontinued on the web and jQuery was rising to stardom. &lt;/p&gt;

&lt;p&gt;I consider myself so lucky because I was able to witness the state of front-end development becoming increasingly more complex &lt;em&gt;while&lt;/em&gt; I was an active member of this industry. So I had the privilege to learn new stuff as they were coming up.&lt;/p&gt;

&lt;p&gt;That being said, if I saw a roadmap of "How to become a front-end developer" as a beginner nowadays I'd feel scared, overwhelmed, and consider a career as a long-haul driver. I mean it!&lt;/p&gt;

&lt;p&gt;But here are some words of encouragement my fellow beginner, for there is no other way than the way of knowledge!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Seriously, there is no other way.&lt;/strong&gt; You have to be okay with the fact that you'll be studying your whole life. Such is the blessing and curse of the programmer. &lt;/p&gt;

&lt;p&gt;Things change, new languages and frameworks are created every year, you don't have to learn &lt;em&gt;everything&lt;/em&gt; but it is very important to stay curious and find joy in learning new nerdy programming stuff.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Learn how to learn.&lt;/strong&gt; You have a lot on your plate, mate, so be sure to make good use of your study time. There are plenty of tools to help you so, a nice one is called the &lt;a href="https://vark-learn.com/the-vark-questionnaire/"&gt;VARK Questionnaire&lt;/a&gt; and helps you identify how you learn better. &lt;/p&gt;

&lt;p&gt;Personally, I like watching hour-long introductions to new tools before moving to articles, docs, and tutorials. And only then I move to the more practical stuff.  &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pick a path.&lt;/strong&gt; Try to learn everything and you'll suck at a lot of stuff. One of the best things I did career-wise was to give up on being a mediocre full-stack developer and focus on being a really good front-end engineer. &lt;/p&gt;

&lt;p&gt;Narrowing down your focus reduces the amount of stuff you need to learn and gives you time to really develop a skill. Just be sure to pick a path that's viable and have enough job openings.   &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Apply what you learn.&lt;/strong&gt; Cramming a bunch of theory with no practice is a surefire way to burn-out. Try tinkering with the stuff you just learned. See if that library works as nice as it's docs says. &lt;/p&gt;

&lt;p&gt;Break stuff! You're the sole responsible for your learning, so make it fun!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Start with the basics.&lt;/strong&gt; I'm ending with the most important one. Even if you have a lot to learn and are in a hurry, learning the basics will make your journey much smoother. &lt;/p&gt;

&lt;p&gt;If you're starting as a front-end developer, give yourself plenty of time to learning the basics of HTML, CSS, JS, and how browsers work before moving into harder stuff like React and bundlers. &lt;/p&gt;

&lt;p&gt;The same applies to other areas. You can't build a strong house without well-laid foundations!&lt;/p&gt;




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

&lt;p&gt;Aaand that's a wrap. I covered every single one of my learnings about these classic problems.&lt;/p&gt;

&lt;p&gt;If you just scrolled to the conclusion, &lt;strong&gt;here's a quick summary&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Being an actual impostor is hard and you're probably doing fine.&lt;/li&gt;
&lt;li&gt;It is ok to feel bad about failure as long as you learn (and teach!) from it.&lt;/li&gt;
&lt;li&gt;People’s stories are different and comparing yourself to them is a bit dumb.&lt;/li&gt;
&lt;li&gt;Yes, there is a lot to learn. Pick an area and try to improve consistently.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;And as a final takeaway. Don't worry about &lt;em&gt;fixing&lt;/em&gt; any of these issues, they come and go.&lt;/p&gt;

&lt;p&gt;Instead, use your energy to learn how to deal with them and you'll make your career a more enjoyable race to run.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Please let me know your thoughts on this article, share your tips in the comments!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I still have a lot to learn and will certainly publish an updated edition of this article in the future. So stay tuned and &lt;a href="https://twitter.com/paladini_dev"&gt;follow me on Twitter&lt;/a&gt; for takes on front-end, career, soft-skills, and the occasional shitpost.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Oh, and if you found this article genuinely helpful, please share it with your friends and peers. 😄&lt;/strong&gt;&lt;/p&gt;




&lt;p&gt;Photo by &lt;a href="https://unsplash.com/@maxvdo?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText"&gt;Max van den Oetelaar&lt;/a&gt; on Unsplash&lt;/p&gt;




&lt;h2&gt;
  
  
  Hey, let's connect 👋
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>career</category>
      <category>mentalhealth</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Say Goodbye to Pesky Overflowing Text With the text-overflow CSS Property</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Wed, 14 Oct 2020 11:54:17 +0000</pubDate>
      <link>https://dev.to/vtrpldn/say-goodbye-to-pesky-overflowing-text-with-the-text-overflow-css-property-1jee</link>
      <guid>https://dev.to/vtrpldn/say-goodbye-to-pesky-overflowing-text-with-the-text-overflow-css-property-1jee</guid>
      <description>&lt;p&gt;Here's a neat little trick:&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;text-overflow&lt;/code&gt; + &lt;code&gt;overflow&lt;/code&gt; CSS properties to deal with long strings that break your UI. &lt;/p&gt;

&lt;p&gt;Check it out:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgvrw2ieqh0mrgl49mu2.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fpgvrw2ieqh0mrgl49mu2.gif" alt="example of text-overflow in action"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is better than truncating the string with JavaScript because you can still copy and paste it fully.&lt;/p&gt;

&lt;p&gt;And it is way more flexible because it adapts to the container's width.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwl5y6n1q1v87iw0b8lk3.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Fwl5y6n1q1v87iw0b8lk3.gif" alt="another example of text-overflow in action, this time with changing width"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And that's it! There ain't much more to it, really. This is a neat little trick in its purest form, a small piece of webdev wisdom fit to a small specific problem. &lt;/p&gt;

&lt;p&gt;Oh, and &lt;code&gt;text-overflow&lt;/code&gt; has been around for a while so I'd say that even the Nintendo DS Browser supports this property. 😄&lt;/p&gt;




&lt;p&gt;Does anybody know who's the creator of that classic CSS IS AWESOME logo? I've seen it in mugs and stickers everywhere but couldn't track the creator to give them credit.&lt;/p&gt;




&lt;h2&gt;
  
  
  Hey, let's connect 👋
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev" rel="noopener noreferrer"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>	I Got the 16 Week Streak Badge. Here’s Everything I Learned About Consistency</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Wed, 07 Oct 2020 12:03:43 +0000</pubDate>
      <link>https://dev.to/vtrpldn/i-got-the-16-week-streak-badge-here-s-everything-i-learned-about-consistency-2nna</link>
      <guid>https://dev.to/vtrpldn/i-got-the-16-week-streak-badge-here-s-everything-i-learned-about-consistency-2nna</guid>
      <description>&lt;p&gt;Last week I got the 16 Week Streak badge 🥳&lt;/p&gt;

&lt;p&gt;This is the longest I've been writing consistently. I'm sure that I couldn't have done it if it wasn't for this beautiful community.  &lt;/p&gt;

&lt;p&gt;I'm beyond grateful.&lt;/p&gt;

&lt;p&gt;And to celebrate that here's my 16-week review. Today I'll be looking back to early June and sharing everything I've learned since then. Stick around if you struggle with consistency, some of my learnings might be useful.&lt;/p&gt;

&lt;p&gt;Let's start from the beginning:&lt;/p&gt;

&lt;h2&gt;
  
  
  Why I started writing
&lt;/h2&gt;

&lt;p&gt;I'll be honest you here, I began writing for pretty selfish reasons. &lt;/p&gt;

&lt;p&gt;See, I'm a front-end developer, I've been doing it for quite a while now and I love it. But, simply put, I don't feel like doing it full-time for the rest of my life.&lt;/p&gt;

&lt;p&gt;I look forward to another decade or so of slinging divs and pushing pixels. After that, I want to quit the grind and be an educator much like Wes Bos, Kent C. Dodds, and so many others. &lt;/p&gt;

&lt;p&gt;So yeah, I started writing here because I need to build an audience. This was another step in my career plan. But something interesting happened during these four months...&lt;/p&gt;

&lt;p&gt;The more I kept publishing the more I realized that my work was actually helping quite a lot of people. And that felt very, very rewarding. Which in turn gave me even more strength to keep doing it.&lt;/p&gt;

&lt;p&gt;So, for the first time in my career, I feel that I'm &lt;em&gt;truly&lt;/em&gt; giving back to the community that helped me so much. And that's a very powerful feeling. &lt;/p&gt;

&lt;h2&gt;
  
  
  What I learned and how I kept writing
&lt;/h2&gt;

&lt;p&gt;One thing that kept me here in the past few months is that DEV became a safe haven for me during this pandemic.&lt;/p&gt;

&lt;p&gt;Instead of obsessing about how crappy this year has been, I could stick around and have pleasant conversations with the community. Writing stuff and engaging in the comments became some kind of therapy. &lt;/p&gt;

&lt;p&gt;But hey, I have better advice than this personal anecdote! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Here are some consistency tips:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  1. Have a clear writing goal
&lt;/h3&gt;

&lt;p&gt;To be consistent you must first be aware of what consistency means for you. You have to have a clear goal in mind. My goal to publish an article every week, as long as I'm doing it I pass the consistency check.&lt;/p&gt;

&lt;p&gt;One thing that helps is to have a somewhat flexible goal though. No matter how much you prepare, sometimes life happens so it is better to have some leeway. &lt;/p&gt;

&lt;p&gt;For instance, my goal is to publish an article every Wednesday. I'm okay with publishing it Thursday or Friday if something happens. But Friday 11:59 PM is my absolute deadline. &lt;/p&gt;

&lt;h3&gt;
  
  
  2. Use your idle time to think about your content
&lt;/h3&gt;

&lt;p&gt;Ideas need some time to ferment. &lt;/p&gt;

&lt;p&gt;Using your free time to actively think about your content makes it easier to put it down when the time comes. Try to come up with core ideas first and let them bounce inside your head for a couple of days.&lt;/p&gt;

&lt;p&gt;But don't push yourself too hard! You can do it whenever your mind is wandering, like when you're doing the dishes or taking a shower. You'll see &lt;em&gt;how much easier&lt;/em&gt; is to write down a concept after you allowed it to mature. &lt;/p&gt;

&lt;h3&gt;
  
  
  3. Be ok with publishing imperfect work
&lt;/h3&gt;

&lt;p&gt;There are weeks where I write excellent work and feel like a genius. Some other weeks I can't write anything that I'm happy with. In both cases, I publish what I wrote.&lt;/p&gt;

&lt;p&gt;See, the single most important thing you need to do keep consistency is… to be consistent! &lt;/p&gt;

&lt;p&gt;I know that this sounds obvious but you &lt;em&gt;must&lt;/em&gt; keep momentum. It is much harder to go back to writing after you stopped, even if it was for a week only. So keep in mind that publishing imperfect is bad, but  breaking your streak is much, much worse.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Engage with the community
&lt;/h3&gt;

&lt;p&gt;Writing for the sake of writing will only get you so far.&lt;/p&gt;

&lt;p&gt;Having a genuine interest in your reader makes the writing experience more satisfactory. Finding fun in the comments in one more incentive to keep you writing every week.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;And here are some more general tips:&lt;/strong&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  5. What seems obvious to you can be outstanding to beginners
&lt;/h3&gt;

&lt;p&gt;I started my &lt;a href="https://dev.to/vtrpldn/series/8696"&gt;neat little tricks&lt;/a&gt; series focused on code newbies and I find great joy writing for that audience. And as long as there are beginners, there will be opportunities to teach, share, and learn. &lt;/p&gt;

&lt;h3&gt;
  
  
  6. Don't be put off by other peoples' work
&lt;/h3&gt;

&lt;p&gt;Another good thing to keep in mind is that even if there are a million articles about a certain subject, you should still write yours. &lt;/p&gt;

&lt;p&gt;But make it truly yours, let your personality shine and write it in a way that no one else could. &lt;/p&gt;

&lt;h3&gt;
  
  
  7. Try not taking yourself too seriously
&lt;/h3&gt;

&lt;p&gt;One funny thing about this writing experience is that my most viewed articles are the ones I had the most fun writing. &lt;/p&gt;

&lt;p&gt;Programming is a hard subject and adding a little bit of playfulness can make your content easier to digest.&lt;/p&gt;

&lt;h2&gt;
  
  
  What do I expect for week 32
&lt;/h2&gt;

&lt;p&gt;Well, I'll still be around here writing, I'm sure about that. &lt;/p&gt;

&lt;p&gt;Hopefully, in the next four months, my reach will increase even faster, so I'll be able to help more people. That's something I look forward too.&lt;/p&gt;

&lt;p&gt;I also want to write more creative articles like "VS Code shortcuts that I would teach myself if I had a time machine with limited fuel". I had a blast writing this one and was very much surprised by how well it performed.&lt;/p&gt;

&lt;p&gt;I'm not sure if I have the time for writing more than one article a week. But that definitely something that I look up to.&lt;/p&gt;

&lt;p&gt;And I'll keep working on the &lt;a href="https://dev.to/vtrpldn/series/8380"&gt;"Extremely reusable components"&lt;/a&gt; and &lt;a href="https://dev.to/vtrpldn/series/8696"&gt;"Neat little tricks"&lt;/a&gt; series" as there's still quite a lot of good content to squeeze there!&lt;/p&gt;

&lt;p&gt;But if 2020 has taught us something is that everything might change, so who knows? 😄&lt;/p&gt;




&lt;p&gt;Thanks for reading! And thanks for skimming if you just scrolled around a little bit. That's ok, we all do that. &lt;/p&gt;

&lt;p&gt;I hope that my learnings serve you well on your journey toward consistent writing. Leave a comment if you need any help with it, I'm far from an expert but I can help. We're all in the same boat here. &lt;/p&gt;




&lt;h2&gt;
  
  
  Hey, let's connect 👋
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>career</category>
      <category>writing</category>
      <category>meta</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Show and Hide Content Easily With details and summary HTML Tags</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Wed, 30 Sep 2020 12:00:09 +0000</pubDate>
      <link>https://dev.to/vtrpldn/show-and-hide-content-easily-with-details-and-summary-html-tags-3eif</link>
      <guid>https://dev.to/vtrpldn/show-and-hide-content-easily-with-details-and-summary-html-tags-3eif</guid>
      <description>&lt;p&gt;Here's a neat little trick:&lt;/p&gt;

&lt;p&gt;You can use the &lt;code&gt;&amp;lt;details&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;summary&amp;gt;&lt;/code&gt; HTML tags to create a simple accordion/collapsible UI.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffnfv4dzovmj7smzx50vr.gif" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fi%2Ffnfv4dzovmj7smzx50vr.gif" alt="Summary/Details tags example"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The only problem here is that it looks rather plain and uninteresting. &lt;/p&gt;

&lt;p&gt;But nothing that a few lines of CSS can't fix! Here's how it looks with just a little bit of styling. &lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/pel2y?view=preview&amp;amp;module=/index.html"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Remember that you can click the "Open Sandbox" button and edit the styles yourself. I'm sure that you can make it look even nicer. 😄&lt;/p&gt;

&lt;p&gt;Oh, and here's the CSS, take a look. It features a couple hacks with &lt;code&gt;padding&lt;/code&gt; and &lt;code&gt;box-shadow&lt;/code&gt; to make the "border" look consistent but, other than that, it is a pretty simple change.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="c"&gt;/* The --padding variable help us control 
the &amp;lt;details&amp;gt; and &amp;lt;summary&amp;gt; spacing */&lt;/span&gt;
&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;16px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;details&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;inset&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;details&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;open&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nt"&gt;details&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;summary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--padding&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--padding&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="err"&gt;*&lt;/span&gt; &lt;span class="m"&gt;-1&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;font-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;cursor&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;pointer&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;space-between&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;list-style&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* Hides the default arrow */&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;details&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;open&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;summary&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;4px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* Adds an icon when the &amp;lt;details&amp;gt; is closed... */&lt;/span&gt;
&lt;span class="nt"&gt;details&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;summary&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"+"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* ...and switches it when &amp;lt;details&amp;gt; is open */&lt;/span&gt;
&lt;span class="nt"&gt;details&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;open&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;summary&lt;/span&gt;&lt;span class="nd"&gt;::after&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;"-"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="c"&gt;/* Removes the ugly default arrow on Chrome */&lt;/span&gt;
&lt;span class="nt"&gt;details&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;summary&lt;/span&gt;&lt;span class="nd"&gt;::-webkit-details-marker&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&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;p&gt;I love how much you can accomplish with plain HTML and CSS. &lt;/p&gt;

&lt;p&gt;And by using standard HTML tags you get great accessibility for free!&lt;/p&gt;

&lt;h2&gt;
  
  
  But wait, there's more!
&lt;/h2&gt;

&lt;p&gt;You can go even further and transform these two tags into a powerful and, dare I say, &lt;a href="https://dev.to/vtrpldn/series/8380"&gt;&lt;em&gt;extremely reusable&lt;/em&gt;&lt;/a&gt; component.&lt;/p&gt;

&lt;h3&gt;
  
  
  Let's add some React to it! ⚛️
&lt;/h3&gt;

&lt;p&gt;These two tags work very well with React's component composition pattern. &lt;/p&gt;

&lt;p&gt;So you can just go ahead and create a component to help you toggle stuff more consistently and easier. &lt;/p&gt;

&lt;p&gt;Look:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/3fjee?view=editor&amp;amp;module=/src/Collapsible.js"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Then you can import that component and use it like so:&lt;/p&gt;

&lt;p&gt;&lt;iframe src="https://codesandbox.io/embed/3fjee?view=split&amp;amp;module=/src/App.js"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This is a great component to have on your toolbelt for when you need to implement a few accordions quickly.&lt;/p&gt;

&lt;h3&gt;
  
  
  Thanks for checking out this neat little trick 👋
&lt;/h3&gt;

&lt;p&gt;I hope it comes in handy soon! &lt;/p&gt;

&lt;p&gt;Do you have a suggestion for a neat little trick? Leave it on the comments!&lt;/p&gt;

&lt;p&gt;Oh! And remember to check the other articles on this series below. They are some spicy little nuggets of webdev knowledge.&lt;/p&gt;

&lt;p&gt;Cover photo by &lt;a href="https://unsplash.com/@dominik_photography?utm_source=unsplash&amp;amp;utm_medium=referral&amp;amp;utm_content=creditCopyText" rel="noopener noreferrer"&gt;Dominik Vanyi&lt;/a&gt; on Unsplash&lt;/p&gt;




&lt;h2&gt;
  
  
  Hey, let's connect 👋
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://twitter.com/paladini_dev" rel="noopener noreferrer"&gt;Follow me on Twitter&lt;/a&gt; and let me know you liked this article! &lt;/p&gt;

&lt;p&gt;And if you &lt;em&gt;really&lt;/em&gt; liked it, make sure to share it with your friends, that'll help me a lot 😄&lt;/p&gt;

</description>
      <category>html</category>
      <category>css</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>How do you deal with the endless stream of interruptions that we have nowadays?</title>
      <dc:creator>Vitor Paladini</dc:creator>
      <pubDate>Sun, 27 Sep 2020 23:39:29 +0000</pubDate>
      <link>https://dev.to/vtrpldn/how-do-you-deal-with-the-endless-stream-of-interruptions-that-we-have-nowadays-5f1b</link>
      <guid>https://dev.to/vtrpldn/how-do-you-deal-with-the-endless-stream-of-interruptions-that-we-have-nowadays-5f1b</guid>
      <description>&lt;p&gt;Programming is deep work and requires concentration, we all know that.&lt;/p&gt;

&lt;p&gt;However, there are some days that I can help but interrupt myself by browsing Twitter or Hacker News when I'm stuck with a task. Which only makes things worse.&lt;/p&gt;

&lt;p&gt;How do you deal with that? I can see that being laser-focused would make me much more productive but I have been having trouble reaching that kind of concentration.&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>career</category>
    </item>
  </channel>
</rss>
