<?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: Andrew Heinke</title>
    <description>The latest articles on DEV Community by Andrew Heinke (@andrewheinke).</description>
    <link>https://dev.to/andrewheinke</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%2F631932%2Fce3a0fb4-bd5c-44b2-a4aa-f4624e300263.jpeg</url>
      <title>DEV Community: Andrew Heinke</title>
      <link>https://dev.to/andrewheinke</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/andrewheinke"/>
    <language>en</language>
    <item>
      <title>React Interview Challenge #2: Create a ToDo Component</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Sun, 22 May 2022 18:15:18 +0000</pubDate>
      <link>https://dev.to/andrewheinke/react-interview-challenge-2-create-a-todo-component-1bhi</link>
      <guid>https://dev.to/andrewheinke/react-interview-challenge-2-create-a-todo-component-1bhi</guid>
      <description>&lt;h2&gt;
  
  
  This example challenge is something you could expect if you are applying for frontend engineer positions.
&lt;/h2&gt;

&lt;p&gt;You are tasked with creating a todo component and given a list of functional requirements. Give this a go on your own and if you get stuck reference my example demo and code. Links at bottom of post. To simulate an actual interview situation, set yourself a timer for 45 minutes and practice explaining your thought process out loud as you go.&lt;/p&gt;

&lt;h3&gt;
  
  
  Instructions
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Create a todo component&lt;/li&gt;
&lt;li&gt;Component should accept an initial list of todos&lt;/li&gt;
&lt;li&gt;Add an input and button to add new todos to the list&lt;/li&gt;
&lt;li&gt;When a todo is clicked it should update its status (complete/incomplete)

&lt;ul&gt;
&lt;li&gt;Completed todos should have a strike through text style and should display a checkmark icon&lt;/li&gt;
&lt;li&gt;Uncompleted todos should display a hollow circle icon&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;Todos should have a delete button that allows the user to remove the todo&lt;/li&gt;
&lt;li&gt;Extra credit:

&lt;ul&gt;
&lt;li&gt;Add tabs to the top of the todo list to allow users to toggle between all todos, completed todos and incomplete todos&lt;/li&gt;
&lt;li&gt;Add a section to display the number of completed todos out of the total number of todos&lt;/li&gt;
&lt;li&gt;When all todos are completed update the section to display a success message&lt;/li&gt;
&lt;li&gt;Support both light and dark mode styles&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Here are icons to use for the component:&lt;/p&gt;

&lt;p&gt;Checkmark Icon:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512" fill="currentColor"&amp;gt;
    &amp;lt;path d="M0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256zM371.8 211.8C382.7 200.9 382.7 183.1 371.8 172.2C360.9 161.3 343.1 161.3 332.2 172.2L224 280.4L179.8 236.2C168.9 225.3 151.1 225.3 140.2 236.2C129.3 247.1 129.3 264.9 140.2 275.8L204.2 339.8C215.1 350.7 232.9 350.7 243.8 339.8L371.8 211.8z" /&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Unchecked Icon:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg fill="currentColor" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"&amp;gt;
    &amp;lt;path d="M512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 48C141.1 48 48 141.1 48 256C48 370.9 141.1 464 256 464C370.9 464 464 370.9 464 256C464 141.1 370.9 48 256 48z" /&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Trashcan Icon:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" fill="currentColor"&amp;gt;
    &amp;lt;path d="M135.2 17.69C140.6 6.848 151.7 0 163.8 0H284.2C296.3 0 307.4 6.848 312.8 17.69L320 32H416C433.7 32 448 46.33 448 64C448 81.67 433.7 96 416 96H32C14.33 96 0 81.67 0 64C0 46.33 14.33 32 32 32H128L135.2 17.69zM394.8 466.1C393.2 492.3 372.3 512 346.9 512H101.1C75.75 512 54.77 492.3 53.19 466.1L31.1 128H416L394.8 466.1z" /&amp;gt;
&amp;lt;/svg&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://ixwtmv.csb.app/"&gt;Live Demo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codesandbox.io/s/todo-component-ixwtmv"&gt;Code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>javascript</category>
      <category>design</category>
    </item>
    <item>
      <title>React Interview Challenge: Create a Star Rating Component</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Wed, 18 May 2022 16:07:38 +0000</pubDate>
      <link>https://dev.to/andrewheinke/react-interview-challenge-create-a-star-rating-component-4b0d</link>
      <guid>https://dev.to/andrewheinke/react-interview-challenge-create-a-star-rating-component-4b0d</guid>
      <description>&lt;h2&gt;
  
  
  This example challenge is something you could expect if you are applying for frontend engineer positions.
&lt;/h2&gt;

&lt;p&gt;You are tasked with creating a star rating component and given a list of functional requirements. Give this a go on your own and if you get stuck reference my example demo and code. Links at bottom of post. To simulate an actual interview situation, set yourself a timer for 45 minutes and practice explaining your thought process out loud as you go.&lt;/p&gt;

&lt;p&gt;You are free to use any star icons you want or you can copy and paste these ascii star characters to use in your component:&lt;br&gt;
Filled Star: &lt;code&gt;★&lt;/code&gt;&lt;br&gt;
Unfilled Star: &lt;code&gt;☆&lt;/code&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Instructions:
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Create a star rating component.&lt;/li&gt;
&lt;li&gt;onClick, stars should fill up to the star clicked.&lt;/li&gt;
&lt;li&gt;Stars should change from unfilled to filled onHover and set to unfilled on mouse leave. Star rating should remain as it was when no stars are being hovered.&lt;/li&gt;
&lt;li&gt;The star rating should reset if the current star rating is filled and is clicked.&lt;/li&gt;
&lt;li&gt;The component should allow a default initial star rating and total number of stars to be set.&lt;/li&gt;
&lt;li&gt;Extra Credit:

&lt;ul&gt;
&lt;li&gt;Add a section to show the current star rating percentage to two decimal places.&lt;/li&gt;
&lt;li&gt;Add an input to control the total number of stars.&lt;/li&gt;
&lt;li&gt;Add an input to control the star rating.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://vp00l9.csb.app/"&gt;Live Demo&lt;/a&gt;&lt;br&gt;
&lt;a href="https://codesandbox.io/s/star-rating-component-vp00l9"&gt;Code&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>webdev</category>
      <category>design</category>
      <category>interview</category>
    </item>
    <item>
      <title>React Slideshow Component with autoplay, fullscreen mode and expand all</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Thu, 05 May 2022 19:34:27 +0000</pubDate>
      <link>https://dev.to/andrewheinke/react-slideshow-component-with-autoplay-fullscreen-mode-and-expand-all-4o9b</link>
      <guid>https://dev.to/andrewheinke/react-slideshow-component-with-autoplay-fullscreen-mode-and-expand-all-4o9b</guid>
      <description>&lt;h2&gt;
  
  
  A React Slideshow component with all the bells and whistles
&lt;/h2&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://ligzbo.csb.app/"&gt;Live Demo →&lt;/a&gt;
&lt;/h3&gt;

&lt;h3&gt;
  
  
  &lt;a href="https://codesandbox.io/s/ligzbo"&gt;Code View →&lt;/a&gt;
&lt;/h3&gt;

&lt;p&gt;I loved the slider used in &lt;a href="//educative.io"&gt;https://www.educative.io/&lt;/a&gt; so I wanted to recreate the design and functionality with React.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Previous/Next Slide&lt;/li&gt;
&lt;li&gt;Autoplay slides&lt;/li&gt;
&lt;li&gt;Restart slider&lt;/li&gt;
&lt;li&gt;Expand/Collapse all slides&lt;/li&gt;
&lt;li&gt;Fullscreen slides mode&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Simple API
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const data = [
  {
    title: "First",
    text: "foo bar baz"
  },
  ...
];

...

// optional prop autoPlayTime to control autoplay time on slide
&amp;lt;Slides slides={data} /&amp;gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To avoid repeating code I utilized a few custom hooks:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;useCount&lt;/code&gt; – for controlling active slide index&lt;br&gt;
&lt;/p&gt;

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

export const useCount = (initialValue = 0) =&amp;gt; {
  const [activeIndex, setActiveIndex] = useState(initialValue);

  const increment = () =&amp;gt; {
    setActiveIndex((prev) =&amp;gt; prev + 1);
  };

  const decrement = () =&amp;gt; {
    setActiveIndex((prev) =&amp;gt; prev - 1);
  };

  const reset = () =&amp;gt; {
    setActiveIndex(initialValue);
  };

  return [activeIndex, increment, decrement, reset];
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;useToggle&lt;/code&gt; – for controlling expanded/collapsed slides, autoplay mode and full screen mode&lt;br&gt;
&lt;/p&gt;

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

export const useToggle = (initialValue = false) =&amp;gt; {
  const [state, setState] = useState(initialValue);
  const toggle = useCallback(() =&amp;gt; setState((state) =&amp;gt; !state), []);
  return [state, toggle];
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;useInterval&lt;/code&gt; – for controlling slide increments in autoplay mode&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { useEffect, useRef } from "react";
export const useInterval = (callback, delay) =&amp;gt; {
  const intervalId = useRef(null);
  const savedCallback = useRef(callback);

  useEffect(() =&amp;gt; {
    savedCallback.current = callback;
  });

  useEffect(() =&amp;gt; {
    const tick = () =&amp;gt; savedCallback.current();

    if (typeof delay === "number") {
      intervalId.current = window.setInterval(tick, delay);

      return () =&amp;gt; window.clearInterval(intervalId.current);
    }
  }, [delay]);

  return intervalId.current;
};
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>customhooks</category>
      <category>javascript</category>
      <category>webdev</category>
    </item>
    <item>
      <title>React Hooks Autocomplete Component</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Tue, 03 Aug 2021 14:01:31 +0000</pubDate>
      <link>https://dev.to/andrewheinke/react-hooks-autocomplete-component-3ipp</link>
      <guid>https://dev.to/andrewheinke/react-hooks-autocomplete-component-3ipp</guid>
      <description>&lt;p&gt;&lt;a href="https://codesandbox.io/s/autocomplete-q8j45"&gt;Open Demo Link&lt;/a&gt;&lt;/p&gt;

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

</description>
      <category>react</category>
      <category>showdev</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Mario Kart Tabs UI</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Tue, 25 May 2021 01:38:50 +0000</pubDate>
      <link>https://dev.to/andrewheinke/mario-kart-tabs-ui-3k55</link>
      <guid>https://dev.to/andrewheinke/mario-kart-tabs-ui-3k55</guid>
      <description>&lt;p&gt;&lt;a href="https://codepen.io/andrewheinke/full/abJWamM"&gt;View Fullscreen Demo →&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A fun exercise making Mario Kart tabs using &lt;a href="https://github.com/alpinejs/alpine"&gt;Alpine.js&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/andrewheinke/embed/abJWamM?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>showdev</category>
      <category>css</category>
      <category>webdev</category>
    </item>
    <item>
      <title>Neumorphism eCommerce Landing Page</title>
      <dc:creator>Andrew Heinke</dc:creator>
      <pubDate>Sat, 15 May 2021 21:20:13 +0000</pubDate>
      <link>https://dev.to/andrewheinke/neumorphism-ecommerce-landing-page-dce</link>
      <guid>https://dev.to/andrewheinke/neumorphism-ecommerce-landing-page-dce</guid>
      <description>&lt;p&gt;&lt;a href="https://codepen.io/andrewheinke/full/mdWPezz"&gt;View Fullscreen Demo →&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;A Lord of The Rings eCommerce landing page using neumorphism design. This project includes a color theme changer and local storage to save theme preference.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/andrewheinke/embed/mdWPezz?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>showdev</category>
      <category>css</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
