<?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: Nick Trierweiler</title>
    <description>The latest articles on DEV Community by Nick Trierweiler (@kicksent).</description>
    <link>https://dev.to/kicksent</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%2F194792%2F1a30b80a-5074-43aa-a903-870a8a7f0ec2.jpg</url>
      <title>DEV Community: Nick Trierweiler</title>
      <link>https://dev.to/kicksent</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kicksent"/>
    <language>en</language>
    <item>
      <title>Local SEO is simpler than you think</title>
      <dc:creator>Nick Trierweiler</dc:creator>
      <pubDate>Mon, 02 Jun 2025 04:54:38 +0000</pubDate>
      <link>https://dev.to/kicksent/local-seo-is-simpler-than-you-think-219o</link>
      <guid>https://dev.to/kicksent/local-seo-is-simpler-than-you-think-219o</guid>
      <description>&lt;p&gt;If you are trying to improve local SEO for a small website and read this post, I will save you from reading 3 books, listening to 30 podcast episodes, and reading another 100 blog posts about SEO. &lt;/p&gt;

&lt;p&gt;This year I read a number of great books. About half of them were business related, and the other half development related. &lt;/p&gt;

&lt;p&gt;Among these, I stumbled into a book on SEO. It was great to finally learn about how the internet really functions after being a web developer for 6 years. &lt;/p&gt;

&lt;p&gt;The first thing I learned is that SEO is really Really &lt;strong&gt;REALLY&lt;/strong&gt; complicated. The second thing I learned is that &lt;strong&gt;it's complicated because of developers&lt;/strong&gt;. &lt;/p&gt;

&lt;p&gt;It's our fault because we are so good at automating, scaling, and spamming that is automatable, scalable, and spam-able. If you're a dev reading this right now, you are not surprised in the slightest. &lt;/p&gt;

&lt;p&gt;As an example, I learned from &lt;a href="https://www.youtube.com/@GrumpySEOGuy" rel="noopener noreferrer"&gt;GrumpySEOguy on Youtube&lt;/a&gt; that sidebars with links to other sites can hurt rank because back in the day this was one of the best ways to create backlinks on thousands of pages from website A to point at website B and get a lot of authority. Google has had to take great countermeasures in page rank to avoid the spamming of links because programmers are great at putting links on hundreds of pages. &lt;/p&gt;

&lt;p&gt;There are 100 more examples like this, and they can all be summarized as "Google does X because programmers do Y if they don't do X". &lt;/p&gt;

&lt;p&gt;But having said all of this, there's one thing I want to give y'all that I think is really nice to know if you are a website builder who builds small local websites, has a small local business, or is helping a family member of friend with their local site. &lt;/p&gt;

&lt;p&gt;Local SEO is much simpler than SEO. &lt;/p&gt;

&lt;p&gt;GrumpySEO guy hasn't made a video about this yet, but there's only a few things to do if you have a website that needs to serve traffic for searches with "near me" at the end. Ex: "plumber near me", "coffee shop near me", etc. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;You need to fully fill out a google business profile(GMB) and add the website to it. Full out the profile in a way that users searching for your services would see you if they searched "___ near me". &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Be sure that the google profile has an address or service area that is local to where you are providing services. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Be sure that any other websites that mention you, like yellow pages, facebook pages, instagram accounts, etc. all reference the same name, address or service area, etc. that your GMB profile does. This will help google to know about who your business is and tie these items together. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Get reviews. If you have already served customers, you want to follow up with them and get reviews. Reviews are going to directly help the business to show up when a local user searches for your service. &lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;That's it. Don't go read 3 books, listen to 30 podcast episodes, and read 100 blog posts on it. Just read what I typed here, and implement it. &lt;/p&gt;

&lt;p&gt;If you got something out of this. &lt;a href="https://x.com/siroccomask" rel="noopener noreferrer"&gt;Follow me on X&lt;/a&gt;. I am always hacking on something new. Right now, it's &lt;a href="//studynearme.com"&gt;studynearme&lt;/a&gt; which is my site that finds laptop-friendly places to work for a day with 1 tap. &lt;/p&gt;

&lt;p&gt;Cheers. &lt;/p&gt;

</description>
      <category>webdev</category>
      <category>website</category>
      <category>seo</category>
    </item>
    <item>
      <title>Simple Free Flexible Styled SVG Icons in React</title>
      <dc:creator>Nick Trierweiler</dc:creator>
      <pubDate>Fri, 15 Sep 2023 14:17:17 +0000</pubDate>
      <link>https://dev.to/kicksent/simple-free-flexible-styled-svg-icons-in-react-3aie</link>
      <guid>https://dev.to/kicksent/simple-free-flexible-styled-svg-icons-in-react-3aie</guid>
      <description>&lt;h2&gt;
  
  
  Simple Pattern to Use SVG Icons in a React App
&lt;/h2&gt;

&lt;p&gt;When building a React app, it's common to need a variety of icons. You might use them for buttons, navigation, or simply for decoration. One of the best resources for free, high-quality icons is &lt;a href="https://tabler-icons.io/" rel="noopener noreferrer"&gt;Tabler Icons&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In this blog post, I'll show you the simplest way to use svg icons in a React application, especially if you're already comfortable with creating React components.&lt;/p&gt;

&lt;h2&gt;
  
  
  Creating an Icon Component
&lt;/h2&gt;

&lt;p&gt;Firstly, navigate to the &lt;a href="https://tabler-icons.io/" rel="noopener noreferrer"&gt;Tabler Icons website&lt;/a&gt; and find an icon that you like, and  copy the SVG code. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Note: If you are using your own .svg files, you can copy the html out of the file and place it directly in the component. Loading svg files in react can be overly complex, so I usually opt for this.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;Create a new React component within the &lt;code&gt;icons&lt;/code&gt; folder and paste the SVG code inside of a new component.&lt;/p&gt;

&lt;p&gt;For example, let's create a search icon component:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="c1"&gt;// SearchIcon.tsx&lt;/span&gt;
&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;SearchIcon&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;({&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt; &lt;span class="o"&gt;=&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="nl"&gt;className&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="o"&gt;=&amp;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;svg&lt;/span&gt; &lt;span class="na"&gt;xmlns&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"http://www.w3.org/2000/svg"&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="s2"&gt;`&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt; icon icon-tabler icon-tabler-search`&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt; &lt;span class="na"&gt;width&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"24"&lt;/span&gt; &lt;span class="na"&gt;height&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"24"&lt;/span&gt; &lt;span class="na"&gt;viewBox&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"0 0 24 24"&lt;/span&gt; &lt;span class="na"&gt;strokeWidth&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt; &lt;span class="na"&gt;stroke&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"currentColor"&lt;/span&gt; &lt;span class="na"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt; &lt;span class="na"&gt;strokeLinecap&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"round"&lt;/span&gt; &lt;span class="na"&gt;strokeLinejoin&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"round"&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;path&lt;/span&gt; &lt;span class="na"&gt;stroke&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"M0 0h24v24H0z"&lt;/span&gt; &lt;span class="na"&gt;fill&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"none"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;path&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;path&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;path&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;path&lt;/span&gt; &lt;span class="na"&gt;d&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"M21 21l-6 -6"&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;path&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;svg&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;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="nx"&gt;SearchIcon&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Customizing the Icon
&lt;/h2&gt;

&lt;p&gt;Notice the optional &lt;code&gt;className&lt;/code&gt; prop. This allows us to pass any Tailwind CSS classes (or any other classes) to style our icon, making it versatile. We can adjust the text color, background color, dimensions, and margins.&lt;/p&gt;

&lt;h3&gt;
  
  
  Basic Usage
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;SearchIcon&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./icons/SearchIcon&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;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="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="p"&gt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SearchIcon&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;h3&gt;
  
  
  Styled with Tailwind CSS with text, margin, and color
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight tsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;SearchIcon&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./icons/SearchIcon&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;App&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="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="p"&gt;&amp;gt;&lt;/span&gt;
      Search&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;SearchIcon&lt;/span&gt; &lt;span class="na"&gt;className&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;"ms-2 text-blue-500"&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;em&gt;Note: We can also use this pattern for other .svg images which may have additional styling requirements.&lt;/em&gt;&lt;/p&gt;

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

&lt;p&gt;This pattern is simple, flexible, and free. If you found this valuable, or have a better pattern for icons, let me know!&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Improved JSX Readability with Switch-Case Statements in React Components</title>
      <dc:creator>Nick Trierweiler</dc:creator>
      <pubDate>Fri, 08 Sep 2023 00:17:07 +0000</pubDate>
      <link>https://dev.to/kicksent/improved-jsx-readability-with-switch-case-statements-in-react-components-25f</link>
      <guid>https://dev.to/kicksent/improved-jsx-readability-with-switch-case-statements-in-react-components-25f</guid>
      <description>&lt;p&gt;Recently, I've come across this pattern more frequently and I wanted to share. It's a bit more verbose initially, but is nice on the eyes. &lt;/p&gt;

&lt;h2&gt;
  
  
  The Typical Approach: Conditional Rendering in JSX
&lt;/h2&gt;

&lt;h3&gt;
  
  
  The Traditional Version
&lt;/h3&gt;

&lt;p&gt;Consider this example where a button component could take on one of three styles: primary, secondary, or danger.&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ButtonProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;danger&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ButtonProps&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="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="o"&gt;&amp;lt;&amp;gt;&lt;/span&gt;
      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-primary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Primary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-secondary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Secondary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;      &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;danger&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-danger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Danger&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;}
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;  &lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here, we used conditional rendering directly within the JSX. It's not a problem in this small example, but as your component grows, this pattern can create clutter and hamper readability.&lt;/p&gt;

&lt;h3&gt;
  
  
  A Switch-Case Version
&lt;/h3&gt;

&lt;p&gt;By using a &lt;code&gt;switch-case&lt;/code&gt; statement, we can make the code much more readable:&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ButtonProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;danger&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;Button&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ButtonProps&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="kd"&gt;type&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-primary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Primary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-secondary&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Secondary&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&gt;;
&lt;/span&gt;    &lt;span class="na"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-danger&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Danger&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&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;h2&gt;
  
  
  The Readability Advantage of Using Switch-Case
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Easy Scanning
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;Switch-case&lt;/code&gt; statements are visually easier to parse, allowing developers to understand the code faster.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Logical Grouping
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;The &lt;code&gt;case&lt;/code&gt; and &lt;code&gt;default&lt;/code&gt; keywords signal distinct branches clearly, unlike conditional rendering where the logic can get lost amidst JSX tags.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Decreased Cognitive Load
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Reading through a &lt;code&gt;switch-case&lt;/code&gt; statement requires less cognitive effort than tracking multiple conditional operators.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Finally, I want to point out that often the best version is a combination of switch case and conditional statements:&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="kr"&gt;interface&lt;/span&gt; &lt;span class="nx"&gt;ButtonProps&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;type&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;danger&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;small&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;medium&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;large&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;disabled&lt;/span&gt;&lt;span class="p"&gt;?:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&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;Button&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;React&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;FC&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;ButtonProps&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="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;size&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;disabled&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;baseClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`btn-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="kd"&gt;type&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;sizeClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="s2"&gt;`btn-&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;size&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="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;disabledClass&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;disabled&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;btn-disabled&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="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;switch &lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;primary&lt;/span&gt;&lt;span class="dl"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&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="nx"&gt;baseClass&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="nx"&gt;sizeClass&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="nx"&gt;disabledClass&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="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Primary&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;secondary&lt;/span&gt;&lt;span class="dl"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&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="nx"&gt;baseClass&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="nx"&gt;sizeClass&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="nx"&gt;disabledClass&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="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Secondary&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="k"&gt;case&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;danger&lt;/span&gt;&lt;span class="dl"&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="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&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="nx"&gt;baseClass&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="nx"&gt;sizeClass&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="nx"&gt;disabledClass&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="o"&gt;&amp;gt;&lt;/span&gt;
          &lt;span class="nx"&gt;Danger&lt;/span&gt;
        &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;      &lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="nl"&gt;default&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;button&lt;/span&gt; &lt;span class="nx"&gt;className&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;btn-default&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;&lt;span class="nx"&gt;Default&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/button&amp;gt;&lt;/span&gt;&lt;span class="err"&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;In my personal opinion, this is far more readable than just conditional statements alone which often become difficult to digest when they are nested more than one level deep. &lt;/p&gt;

&lt;p&gt;This is just another tool for the toolbelt. Use it as you find useful. That is all. &lt;/p&gt;

</description>
      <category>typescript</category>
      <category>readability</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Today I started using a habit tracker</title>
      <dc:creator>Nick Trierweiler</dc:creator>
      <pubDate>Sat, 07 Dec 2019 16:42:10 +0000</pubDate>
      <link>https://dev.to/kicksent/today-i-started-using-a-habit-tracker-5ela</link>
      <guid>https://dev.to/kicksent/today-i-started-using-a-habit-tracker-5ela</guid>
      <description>&lt;p&gt;I have allowed some bad habits to form which are affecting my effectiveness and productivity. One of my costly time wastes is opening my phone for a task which is okay for work - reading an important email, answering a text from my girlfriend or family member - and then proceeding to unconsciously open the "reddit is fun" app. Before I know it, I've spent 30 minutes to an hour to cats and programmer jokes.  &lt;em&gt;sigh&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Recently, I listened to an audiobook &lt;a href="https://www.audible.com/pd/Atomic-Habits-Audiobook/1524779261" rel="noopener noreferrer"&gt;Atomic Habits&lt;/a&gt; by &lt;a href="https://jamesclear.com/habit-tracker" rel="noopener noreferrer"&gt;James Clear&lt;/a&gt; and have decided to design some habits instead of setting new goals. The writer says that this is the best way to improve and setting a habit that helps facilitate a goal is more effective than simply setting a goal. It's read in a fun way with motivational stories and examples. Let's get into it, I am fired up and ready to start making some improvements! &lt;/p&gt;

&lt;p&gt;Here's the idea: to start a habit I need to make it...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Obvious&lt;/li&gt;
&lt;li&gt;Attractive&lt;/li&gt;
&lt;li&gt;Easy &lt;/li&gt;
&lt;li&gt;Satisfying&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;... and to stop a habit make it...&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Hidden&lt;/li&gt;
&lt;li&gt;Unattractive&lt;/li&gt;
&lt;li&gt;Difficult&lt;/li&gt;
&lt;li&gt;Unsatisfying&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  So here's my short list for now:
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Wanted habits:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Side hustle project work (coding 30 minutes per day) -
Although this one seems like a difficult habit to start, I am already on track so I just need to maintain it.&lt;/li&gt;
&lt;li&gt;Get up at 5 am every day even when I am working from home &lt;/li&gt;
&lt;li&gt;Work out every day (not just when I feel like it)&lt;/li&gt;
&lt;li&gt;Writing content for dev.to and my personal site&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Unwanted habits:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Browsing reddit at work when I use my phone&lt;/li&gt;
&lt;li&gt;Staying up too late&lt;/li&gt;
&lt;li&gt;Hitting the snooze button&lt;/li&gt;
&lt;li&gt;Staying up late in bed watching videos&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I am going to use some strategies from the book here to help me. &lt;/p&gt;

&lt;h1&gt;
  
  
  Starting a habit:
&lt;/h1&gt;

&lt;h2&gt;
  
  
  Habit pairing and chaining: Easy habits can help facilitate harder habits if they lead into each other.
&lt;/h2&gt;

&lt;p&gt;In my case, I have a hard time going to bed when it's time, so I have set a habit that I already do to help lead to this result.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Useful Habit:&lt;/strong&gt; drink some water, brush my teeth, and then floss at 9PM. &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The important part for me on this habit is brushing my teeth right at 9. &lt;/li&gt;
&lt;li&gt;This will help me to also get to bed before 9:30 PM since I most often lie down for the night after I brush my teeth already. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Useful Habit:&lt;/strong&gt; get in bed before 9:30 PM&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Now I have set myself up for success to wake up at 5 AM since I will likely have gotten 7-7.5 hours of sleep at that point. &lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Useful Habit:&lt;/strong&gt; wake up at 5 AM everyday&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Once in bed, I can read until 10 if I choose to. A friend suggested this as a way to wind down for the night. Thanks Michael.&lt;/li&gt;
&lt;/ul&gt;

&lt;h1&gt;
  
  
  Getting rid of a habit:
&lt;/h1&gt;

&lt;h2&gt;
  
  
  What about that pesky reddit browsing problem?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Useless Habit #1:&lt;/strong&gt; Browsing reddit on my phone mindlessly. &lt;br&gt;
To remove the autopilot reaction, I have moved my reddit app off my home screen so I can't click it so easily. I want to disrupt the behavior by making it a bit less convenient so I have to think about it. &lt;br&gt;
If this doesn't work, I have to go stand outside to browse reddit. I have used this one before to quit vaping and it worked well for me. It's a subtle reminder that what I am doing is something that I should be doing less, or not at all.&lt;/p&gt;

&lt;h1&gt;
  
  
  Seriously, make these easy and start slow
&lt;/h1&gt;

&lt;p&gt;The book says this many times in different ways. Start with just one or a few habits that you want to build, and then get those going before taking on new things. The book calls habits compound interest and reminds the reader that a 1% improvement per day is over 300% improvement by the end of the year. I have created 4 habits, but two of them will work together synergistically. For me, this counts as two habits total: one I want to start, and one I want to stop. &lt;/p&gt;

&lt;h1&gt;
  
  
  How to track this?
&lt;/h1&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;a href="https://www.baronfig.com/products/clear-habit-journal" rel="noopener noreferrer"&gt;Clear Habit Journal&lt;/a&gt; - James Clear's habit tracker journal with his design. &lt;/li&gt;
&lt;li&gt;
&lt;a href="https://play.google.com/store/apps/details?id=org.isoron.uhabits&amp;amp;hl=en_US" rel="noopener noreferrer"&gt;Loop - Android&lt;/a&gt; - This is what I am using now.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://play.google.com/store/apps/details?id=com.levor.liferpgtasks&amp;amp;hl=en_US" rel="noopener noreferrer"&gt;Do It Now - Android&lt;/a&gt; - An RPG like tracker but for real life with xp!&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://apps.apple.com/us/app/habit-bull-daily-goal-tracker/id1041482672" rel="noopener noreferrer"&gt;Habit-Bull - iOS&lt;/a&gt; - This one looks great! But it's for IOS so I haven't tried it. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Check out &lt;a href="https://jamesclear.com/habit-tracker" rel="noopener noreferrer"&gt;The Ultimate Habit Tracker Guide: Why and How to Track Your Habits&lt;/a&gt; on the author's website if you want to learn more before buying the audiobook. &lt;/p&gt;

&lt;p&gt;Thanks for reading! &lt;/p&gt;

&lt;p&gt;Nick Trierweiler&lt;br&gt;
&lt;a href="//kicksent.dev"&gt;kicksent.dev&lt;/a&gt;&lt;/p&gt;

</description>
      <category>habits</category>
      <category>goals</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
