<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Jemaul Hunter on Medium]]></title>
        <description><![CDATA[Stories by Jemaul Hunter on Medium]]></description>
        <link>https://medium.com/@jemaulhunter?source=rss-927d30afe504------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*_e6OnJy7RK7dmX3W</url>
            <title>Stories by Jemaul Hunter on Medium</title>
            <link>https://medium.com/@jemaulhunter?source=rss-927d30afe504------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 21 Nov 2026 05:42:30 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@jemaulhunter/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The differences between React Components]]></title>
            <link>https://medium.com/@jemaulhunter/react-components-allow-us-to-modularize-our-code-around-certain-a1a1d044e34?source=rss-927d30afe504------2</link>
            <guid isPermaLink="false">https://medium.com/p/a1a1d044e34</guid>
            <dc:creator><![CDATA[Jemaul Hunter]]></dc:creator>
            <pubDate>Wed, 14 Sep 2022 04:00:02 GMT</pubDate>
            <atom:updated>2022-09-14T14:28:51.573Z</atom:updated>
            <content:encoded><![CDATA[<p>The differences between React Components</p><p>React components allow us to modularize our code in our application.</p><p>There are class components and function components. Components can refer to other components in their output. This allows us to use the same component for any level of detail whether it be a button, a form, a dialog, or a screen.</p><p>There are conditions in order to be considered a component.</p><p>A component must return JSX</p><p>It can only take in one argument i.e. props.</p><p>The function must start with a capital letter.</p><p>The syntax for a class component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vA6XDpnuBaW6Gnv6" /></figure><p>The syntax for a function component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Tu0vkHqmT_S_MIoi" /></figure><p>Courtesy of <a href="https://www.geeksforgeeks.org/">https://www.geeksforgeeks.org</a></p><p>Code to create a Counter using a Class component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*FvhxNiKQ1BXR72Z4" /></figure><p>Image courtesy of webdevsimplified.com</p><p>Code to create a Counter using a Function Component</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*iRL6uMmEexQbszsL" /></figure><p>Image courtesy of webdevsimplified.com</p><p>In the example shown above, you may notice that both types of components allow us to create state, update state, handle user input as well as complete other tasks. The functional component allowed us to do those same things as the class component but with less code, the lack of a necessary constructor as well as the constant use of ‘this.’ utilized throughout the component.</p><p>Here are some key differences between the two types of components.</p><p>In the case of class components, when the state of the component is changed the render method is called. Whereas, function components render the interface whenever the props are changed.</p><p>Functional components take props and return an element. A class component has to include the “extends React.Component” statement, and gives your component access to React.Component’s function. It also requires a render() method, this method returns an element.</p><p>A new feature in the most recent React version is the addition of hooks. They simply allow you to use state and other features in React without using a class. Unfortunately, that means that class components won’t be able to use them.</p><p><strong>“You can’t use Hooks inside a class component, but you can definitely mix classes and function components with Hooks in a single tree. Whether a component is a class or a function that uses Hooks is an implementation detail of that component. In the longer term, we expect Hooks to be the primary way people write React components. ” -Reactjs.org</strong></p><p>What could moving away from class components mean in the long run? You are not loading and transferring as much information before you even begin adding your code. This could be a game changer when it comes to the rendering time for your growing application code base. Function hooks used to be used to simply display information but the introduction of hooks allows them to do pretty much anything that we’d previously needed class components for.</p><p>Both component variations have been very useful React features. The current updates have allowed us to drastically increase the versatility and performance of one over the other. In the end, the more efficient function components are saving us valuable time and energy.</p><p>Sources cited</p><p><a href="https://www.geeksforgeeks.org/">https://www.geeksforgeeks.org</a></p><p><a href="https://reactjs.org/">https://reactjs.org</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a1a1d044e34" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Benefits of using Switch Statements vs If-Else Statements]]></title>
            <link>https://medium.com/@jemaulhunter/the-benefits-of-using-switch-statements-vs-if-else-statements-3e857a0604e2?source=rss-927d30afe504------2</link>
            <guid isPermaLink="false">https://medium.com/p/3e857a0604e2</guid>
            <category><![CDATA[conditional-statements]]></category>
            <category><![CDATA[if-else]]></category>
            <category><![CDATA[switch-statement]]></category>
            <dc:creator><![CDATA[Jemaul Hunter]]></dc:creator>
            <pubDate>Tue, 23 Aug 2022 20:48:08 GMT</pubDate>
            <atom:updated>2022-08-23T20:48:08.239Z</atom:updated>
            <content:encoded><![CDATA[<p>In the following article, I will discuss some advantages and disadvantages of using a Switch Statement in JavaScript. I’ll also include examples of each utilizing the same variables in different expressions.</p><p>Let’s discuss switch statements. The value of the expression is evaluated against the values of each case and the first match encountered will be executed. The default only executes if no matches are found. It consists of “switch”, the expression, case values, statements to be executed when a match occurs, and a break to break to end execution inside the switch block.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*jvpBSN3s0nlGcF3l" /><figcaption>Switch Statement Example</figcaption></figure><p>In this example, the “first” case is a match and thus “Gold” is returned.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/371/0*OUcypbfvx_MiA_0n" /><figcaption>If-Else Statement Example</figcaption></figure><p>Here we can see the same values from our switch expression example in an if-else statement. If-else statements will run depending on whether the expression is determined to be true or false.</p><p>Let’s take a look at some of the pros of using switch statements. We can look at both examples and see that there is very little code, but it is apparent that the switch statement is much more legible at first glance due to the regular indentations. It is very important that anyone reading and maintaining code be able to understand exactly what the original developer’s intentions were. Lengthy conditional blocks are much easier to scan through as well as debug when using switch expressions. Switch expressions execute considerably faster than if-else statements when we have numerous options. Editing is very easy compared to nested if-else statements.</p><p>An if-else statement is convenient in that it tests for both equality and logical expressions while switch expressions only test for equality. It is ideal to use if-else if checking for a boolean value.</p><p>In summary, both conditional statements can be very useful. Switch statements are useful for readability and faster speed of execution. If-else is useful when determining if checked condition is true or false.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3e857a0604e2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>