<?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: Brianna Skinner</title>
    <description>The latest articles on DEV Community by Brianna Skinner (@brib).</description>
    <link>https://dev.to/brib</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%2F457345%2Fd0affe3e-3395-4781-b2ed-5b91e770a67e.png</url>
      <title>DEV Community: Brianna Skinner</title>
      <link>https://dev.to/brib</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brib"/>
    <language>en</language>
    <item>
      <title>GitHub vs GitLab</title>
      <dc:creator>Brianna Skinner</dc:creator>
      <pubDate>Mon, 16 Nov 2020 19:15:42 +0000</pubDate>
      <link>https://dev.to/brib/github-vs-gitlab-3lk9</link>
      <guid>https://dev.to/brib/github-vs-gitlab-3lk9</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BHfiRgrf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sz70f5mphbz74vp2273h.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BHfiRgrf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/i/sz70f5mphbz74vp2273h.jpg" alt="Alt Text"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This blog will review the similarities and differences between GitHub and GitLab.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Git?
&lt;/h2&gt;

&lt;p&gt;Git aims to manage software development projects and files. Files are maintained using a Git repository, which is an environment where Git is initialized to track all changes made to files in your project. It will also build a history over time. You'll know if the project is initialized because there will be a &lt;em&gt;.git/&lt;/em&gt; in the directory. Git repositories are also a way for developers to store, share, test, and collaborate on open source web projects.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Basics of GitLab and GitHub
&lt;/h2&gt;

&lt;h3&gt;
  
  
  GitLab
&lt;/h3&gt;

&lt;p&gt;GitLab provides the and shared goals of a Git repository, but focuses on being a &lt;a href="https://about.gitlab.com/topics/devops/"&gt;DevOps&lt;/a&gt; platform that includes CI/CD toolchain. If there is a CI/CD tool that you are already comfortable with you can use that. Additionally, they do allow third-party CI/CD.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--oofHB2qf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://about.gitlab.com/images/press/devops-lifecycle.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oofHB2qf--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://about.gitlab.com/images/press/devops-lifecycle.png" alt="DevOps"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub
&lt;/h3&gt;

&lt;p&gt;Similar to GitLab, GitHub is a place for hosting Git repositories. They offer public and unlimited private repositories.  However, it uses 3 party software to provide access to tools like CI/CD or GitHub Actions.&lt;/p&gt;

&lt;h2&gt;
  
  
  Key Differences
&lt;/h2&gt;

&lt;p&gt;When choosing between GitLab and Github, it is good to consider the following: &lt;/p&gt;

&lt;h3&gt;
  
  
  Security
&lt;/h3&gt;

&lt;p&gt;In GitHub, other users have access to the source code. This is helpful for open source projects. When collaborating with a team, you can grant them read or write access. However, GitLab allows you to restrict others to just viewing any tracked issues. &lt;/p&gt;

&lt;h3&gt;
  
  
  CI/CID
&lt;/h3&gt;

&lt;p&gt;GitLab CI and GitHub Actions are the built-in CI/CID tools in each. GitLab has automated processes that support the continuous integration of projects. When using GitHub Actions, you'll need to do just a little extra work of writing tasks that will be automated integration.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tracking Issues
&lt;/h3&gt;

&lt;p&gt;Both GitLab and GitHub provide dynamic issue trackers. You can get automatic feedback, assign team members to issues, and use third-party widgets to display issue reports.&lt;/p&gt;

&lt;h3&gt;
  
  
  Community
&lt;/h3&gt;

&lt;p&gt;Currently, GitHub has the largest community between the two. Wikipedia is reporting, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;As of January 2020, GitHub reports having over 40 million users and more than 190 million repositories (including at least 28 million public repositories), making it the largest host of source code in the world.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;With such large numbers and history, you'll find that more programmers will know how to GitHub, helping to shorten your learning curve in finding code solutions.&lt;/p&gt;

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

&lt;p&gt;In conclusion, GitHub focuses on maintaining repositories and providing a platform for developers to network. However, it may require a little more work and integration of third-party tools to get the results you're looking for. That is where GitLab has the advantage because it is built to address having a continuously integrated repository during the program life cycle phases. &lt;/p&gt;

&lt;p&gt;I hope you enjoyed this blog.&lt;/p&gt;

</description>
      <category>github</category>
      <category>git</category>
      <category>gitlab</category>
    </item>
    <item>
      <title>React-Spring Into</title>
      <dc:creator>Brianna Skinner</dc:creator>
      <pubDate>Mon, 09 Nov 2020 13:48:16 +0000</pubDate>
      <link>https://dev.to/brib/react-spring-into-fpp</link>
      <guid>https://dev.to/brib/react-spring-into-fpp</guid>
      <description>&lt;h2&gt;
  
  
  Intro
&lt;/h2&gt;

&lt;p&gt;This blog will be an introduction to a react styling tool, react-spring. It adds pizzas through  spring-physics based animations on the webpage. React-Spring is an animation library for moving interfaces. It is set apart from other tools because it both declarative and imperative. Paul Henschel in, &lt;a href="https://medium.com/@drcmda/hooks-in-react-spring-a-tutorial-c6c436ad7ee4"&gt;&lt;em&gt;Hooks in react-spring, a tutorial&lt;em&gt;&lt;/em&gt;&lt;/em&gt;&lt;/a&gt; describes react-spring as render-props driven. They continue to explain that,&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Render props are expressive, explicit, and usually very easy to use. But since it is internally steered imperatively, supporting hooks was just a matter of a couple of lines added to its core.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;If you have ever used React Motion or Animated, some compare this as a middle ground between the two. Another feature of react-spring is that it can be integrated with other tools. Since the tool is state based, it uses hooks and can be used with state managers, such as redux. React-spring can also be integrated with react-native, react-native-web and more. &lt;/p&gt;

&lt;h3&gt;
  
  
  5 Basic hooks
&lt;/h3&gt;

&lt;p&gt;There are currently 5 hooks in react-spring, each is listed and briefly explained below. More can be read in their &lt;a href="https://www.react-spring.io/docs/hooks/basics"&gt;documentation&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;useSpring
&lt;ul&gt;
&lt;li&gt;turns any data into animated data, with a single line&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;li&gt;useSprings

&lt;ul&gt;
&lt;li&gt;animates data within a list/li&amp;gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;li&gt;useTrail

&lt;ul&gt;
&lt;li&gt;multiple springs with a single dataset, one spring follows or trails behind the other&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;li&gt;useTransition

&lt;ul&gt;
&lt;li&gt;for mount/unmount transitions (lists where items are added/removed/updated)&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;li&gt;useChain

&lt;ul&gt;
&lt;li&gt;to queue or chain multiple animations together&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;/ul&gt;

&lt;h2&gt;
  
  
  Prerequisites
&lt;/h2&gt;

&lt;p&gt;Before we go any further, this article assumes the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js ≥v6 is installed on your machine&lt;/li&gt;
&lt;li&gt;npm is installed on your machine&lt;/li&gt;
&lt;li&gt;You have a basic understanding of React.js&lt;/li&gt;
&lt;li&gt;You have a basic understanding of React hooks&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Installation
&lt;/h2&gt;

&lt;p&gt;To begin, first you’ll need to set up your react application. I will be using create react app.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx create-react-app my-react-spring
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Next cd into the directory and install react-spring.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install react-spring
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Set up
&lt;/h2&gt;

&lt;p&gt;First you’ll import animated and the hook you'll want to use. For this tutorial, we'll use useSpring.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import {useSpring, animated} from 'react-spring'
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;There are two ways you can use react-spring hooks, overwriting or updating existing prop.&lt;/p&gt;

&lt;h4&gt;
  
  
  Overwriting Props
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const props = useSpring({
    opacity: toggle ? true : false,
    marginTop: toggle ? 0 : -500
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  Updating Props
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const [props, set, stop] = useSpring(() =&amp;gt; ({opacity: 1}))
    // Update spring with new props
    set({opacity: toggle ? true : false})
    // Stop animation
    stop()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Using the overwriting props method, now it is time to make your animation.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';
import { useSpring, animated } from 'react-spring';

const App = () =&amp;gt; {
  const animation = useSpring({
    from: { opacity: 0 },
    to: { opacity: 1 }
  });

  const colorAnimation = useSpring({
    from: { color: 'blue' },
    to: { color: `rgb(255,0,0)` }
  });

  const multiAnimation = useSpring({
    from: { opacity: 0, color: 'red' },
    to: [
        { opacity: 1, color: '#ffaaee' },
        { opacity: 1, color: 'red' },
        { opacity: .5, color: '#008000' },
        { opacity: .8, color: 'black' }
    ]
  });
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;animated.h1 style={animation}&amp;gt;Hello World&amp;lt;/animated.h1&amp;gt;
      &amp;lt;animated.h1 style={colorAnimation}&amp;gt;Hello World&amp;lt;/animated.h1&amp;gt;
      &amp;lt;animated.h1 style={multiAnimation}&amp;gt;Hello World&amp;lt;/animated.h1&amp;gt;
    &amp;lt;/div&amp;gt;
  )
};

export default App;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;This example may not be the most glamours, but I hope it helps the concept. Here links to more tutorials on &lt;a href="https://www.digitalocean.com/community/tutorials/react-intro-to-react-spring"&gt;Digital Ocean&lt;/a&gt;, &lt;a href="https://medium.com/@drcmda/hooks-in-react-spring-a-tutorial-c6c436ad7ee4"&gt;Medium&lt;/a&gt;, and &lt;a href="https://blog.logrocket.com/animations-with-react-spring/#:~:text=With%20the%20introduction%20of%20hooks,as%20props%20to%20animated%20data."&gt;LogRocket&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>react</category>
    </item>
    <item>
      <title>Intro Guide to GraphQL</title>
      <dc:creator>Brianna Skinner</dc:creator>
      <pubDate>Wed, 04 Nov 2020 12:44:30 +0000</pubDate>
      <link>https://dev.to/brib/intro-guide-to-graphql-fi1</link>
      <guid>https://dev.to/brib/intro-guide-to-graphql-fi1</guid>
      <description>&lt;p&gt;This blog will provide a brief explanation of GraphQL. &lt;/p&gt;

&lt;h2&gt;
  
  
  What is GraphQL?
&lt;/h2&gt;

&lt;p&gt;GraphQL is a query language designed for APIs. When a query is sent to a API, you'll be able to grab exactly what you are looking for. This reduces the need for multiple endpoints in API routes, over and under fetching data. Another plus is that the returns are highly customizable. This is referred to as declarative data fetching. &lt;/p&gt;

&lt;h3&gt;
  
  
  Example of REST API vs GraphQL
&lt;/h3&gt;

&lt;h4&gt;
  
  
  REST API
&lt;/h4&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REST_API_URL/customers/13
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  GraphQL
&lt;/h4&gt;

&lt;h2&gt;
  
  
  Breaking Down GraphQL
&lt;/h2&gt;

&lt;p&gt;GraphQL is made up of Schema, Queries and Mutations, and Resolvers. This will define how you want to create, store, and retrieve data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Schema
&lt;/h3&gt;

&lt;p&gt;The Schema sets up the layout of how the data will be stored and resolved when it is being fetched through queries, or changed with mutations. Below is an example from the GraphQl &lt;a href="https://graphql.org/graphql-js/type/#graphqlschema"&gt;documentation&lt;/a&gt;. The provided link also shows more types of schemas you can design to best fit your needs.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var MyAppSchema = new GraphQLSchema({
  query: MyAppQueryRootType
  mutation: MyAppMutationRootType
});

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Queries and Mutations
&lt;/h3&gt;

&lt;p&gt;Queries are used to fetch the data and mutations will be to modify data. When fetching or manipulating data, you can even get specifics by passing in arguments to the query string. Shown in the example below.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;query{
   customers(id: "13") {
      name
      email
      number
   }
}
mutation {
  createCustomer(input: {
    name: "Jane Doe",
  }) {
    id
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Resolvers
&lt;/h3&gt;

&lt;p&gt;Resolvers are functions that describe how queries should be handled and responded to. Below is a hard coded example of a resolver, but it can also be an api request for data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;const RootQuery = new GraphQLObjectType({
  name: 'RootQueryType',
  fields: {
    launches: {
      type: new GraphQLList(LaunchType),
      resolve(parent, args) {
        // can be an api request for data
        return [{
            flight_number: 1,
            flight_name: 'Mocha',
            flight_boolean: false,
            rocket: {
              id: 1,
              name: 'BRIBRI',
              boolean: true,
            },
          }]
      }
    }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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

&lt;p&gt;The flexibility of GraphQL one of the reasons it can be integrated with other tools such as &lt;a href="https://docs.mongodb.com/realm/graphql/"&gt;Mongo&lt;/a&gt; and &lt;a href="https://www.digitalocean.com/community/questions/graphql-api-server-for-a-postgres-database"&gt;Postgres&lt;/a&gt; to handle queries server side. GraphQL can even be used on client side data collection using tools such as &lt;a href="https://www.apollographql.com/"&gt;Apollo&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;I hope you enjoyed this brief example of using GraphQL. &lt;/p&gt;

</description>
      <category>graphql</category>
    </item>
    <item>
      <title>Overview of Web Accessibility</title>
      <dc:creator>Brianna Skinner</dc:creator>
      <pubDate>Mon, 26 Oct 2020 14:42:55 +0000</pubDate>
      <link>https://dev.to/brib/overview-of-web-accessibility-9nc</link>
      <guid>https://dev.to/brib/overview-of-web-accessibility-9nc</guid>
      <description>&lt;h2&gt;
  
  
  What is Web Accessibility?
&lt;/h2&gt;

&lt;p&gt;Web accessibility is designing tools, web sites and applications used through the world wide web to be accessible by anyone regardless of their abilities and/or disabilities. Making web content with high accessibility is not only inclusive, but profitable to businesses because it expands the range and audience reached. There are many guidelines out there that provide recommendations for accessibility, but the legally binding guide is the Web Content Accessibility Guidelines (WCAG). &lt;/p&gt;

&lt;h2&gt;
  
  
  Web Content Accessibility Guidelines (WCAG)
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://en.wikipedia.org/wiki/Web_Content_Accessibility_Guidelines"&gt;Wikipedia&lt;/a&gt; explains that, &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"The Web Content Accessibility Guidelines (WCAG) are part of a series of web accessibility guidelines published by the Web Accessibility Initiative (WAI) of the World Wide Web Consortium (W3C), the main international standards organization for the Internet." &lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;WCAG mainly focuses on people with disabilities, but their recommendations create an overall better user experience for all users. The WAI has published multiple guides since 1999 when their first version, 1.0, was released.  The most recent version is 2018's 2.1. When choosing a version, going with the most recent increases inclusivity. However, legally, the United States doesn't have a formal law mandating website accessibility. Nonetheless, version 2.0 was adopted into the United States Section 508 of the Rehabilitation Act of 1973 for Federal agencies. The US General Services Administration's &lt;a href="https://www.section508.gov/manage/laws-and-policies"&gt;Section 508&lt;/a&gt; website summarizes it as &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;"Under Section 508, agencies must give disabled employees and members of the public access to information comparable to the access available to others. The rule updated and reorganized the Section 508 Standards and Section 255 Guidelines in response to market trends and innovations in technology. The refresh also harmonized these requirements with other guidelines and standards both in the U.S. and abroad, including standards issued by the European Commission, and with the World Wide Web Consortium (W3C) Web Content Accessibility Guidelines (WCAG 2.0), a globally recognized voluntary consensus standard for web content and ICT."&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Whichever newest version chosen for WGAC compliance, both 2.0 and 2.1 have four principals. &lt;/p&gt;

&lt;h2&gt;
  
  
  Four Principles of Accessibility
&lt;/h2&gt;

&lt;p&gt;Web content must be perceivable, operable, understandable, and robust. Each principal has a set of testable guidelines provided by WCAG which can be found &lt;a href="https://www.w3.org/TR/2008/REC-WCAG20-20081211/#contents"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Perceivable&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Web cannot cannot be invisible to all user senses&lt;/li&gt;
&lt;/ul&gt;




&lt;li&gt;Operable&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;Users must be able to navigate and operate components&lt;/li&gt;
&lt;/ul&gt;




&lt;li&gt;Understandable

&lt;ul&gt;
&lt;li&gt;All users should be able to understand the content&lt;/li&gt;
&lt;/ul&gt;




&lt;/li&gt;

&lt;li&gt;Robust&lt;/li&gt;

&lt;ul&gt;
&lt;li&gt;Web content should be available to all user's technologies &lt;/li&gt;
&lt;/ul&gt;




&lt;/ul&gt;

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

&lt;p&gt;I hope you enjoyed this overview of web accessibility. If you'd like to know more about being in compliance, check out WCAG's &lt;a href="https://www.w3.org/TR/WCAG20-TECHS/"&gt;Techniques and Failures for Web Content Accessibility Guidelines 2.0&lt;/a&gt; &lt;/p&gt;

</description>
    </item>
    <item>
      <title>Introduction to React Hooks</title>
      <dc:creator>Brianna Skinner</dc:creator>
      <pubDate>Tue, 20 Oct 2020 13:55:00 +0000</pubDate>
      <link>https://dev.to/brib/introduction-to-react-hooks-51d0</link>
      <guid>https://dev.to/brib/introduction-to-react-hooks-51d0</guid>
      <description>&lt;p&gt;This blog will be a brief introduction to React Hooks. Examples will include useState and useEffect Hooks. More hooks can be found with React's &lt;em&gt;Hooks API Reference&lt;/em&gt; &lt;a href="https://reactjs.org/docs/hooks-reference.html"&gt;here&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Functional vs Class Components
&lt;/h2&gt;

&lt;p&gt;Typically when using state in Reactjs, you’ll need to create a class component and store the code in a state object. Using Hooks, you are able to create state in a regular Javascript functional component. Another benefit is that functions initialized in the hook will retain their scope without binding it inside of the class constructor. These features are beneficial because it allows for cleaner and less chucky code. &lt;/p&gt;

&lt;p&gt;Below is a comparison between a React feature created with a functional component and a class component. &lt;/p&gt;

&lt;p&gt;&lt;em&gt;Functional Component with Hooks&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

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

export default function Example() {
  //declare a state
  const [action, setAction] = useState(['blog']);

  const handleClick = () =&amp;gt; {
    if(action === 'blog'){
      setAction('run');
    } else if (action === 'run'){
      setAction('blog');
    }
  }
  return (
    &amp;lt;div&amp;gt;
      &amp;lt;p&amp;gt;Todo: {action}&amp;lt;/p&amp;gt;
      &amp;lt;button onClick={handleClick}&amp;gt;
        Click me
      &amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;em&gt;Class Component&lt;/em&gt;&lt;br&gt;
&lt;/p&gt;

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

class Example extends Component {
  constructor(props) {
    super(props);
    this.state = {
      action: 'blog',
    }
    this.handleClick = this.handleClick.bind(this);
  }
  handleClick() {
    if(action === 'blog'){
      this.setState({action: 'run'});
    } else if (action === 'run'){
      this.setState({ action: 'blog' });
    }
  }
  render() {
    const action = this.state.action;
    return (
      &amp;lt;div&amp;gt;
        &amp;lt;p&amp;gt;Todo: {action}&amp;lt;/p&amp;gt;
        &amp;lt;button onClick={this.handleClick}&amp;gt;
          Click me
        &amp;lt;/button&amp;gt;
      &amp;lt;/div&amp;gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  LifeCycle
&lt;/h2&gt;

&lt;p&gt;To run code during major React lifecycle events, such as ComponentDidMount, you can call the Hook useEffect. React explains, "Unlike componentDidMount and componentDidUpdate, the function passed to useEffect fires after layout and paint, during a deferred event." If necessary, adding the array literal as a argument in useEffect specifies that useEffect should only be called when he Example Component loads. This can prevent as side effect where useEffect is infinitely being called.&lt;br&gt;
&lt;/p&gt;

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

export default function Example() {
  //declare a state
  const [action, setAction] = useState([]);

  //API Request
  const someAsyncFunction = async () =&amp;gt; {
    try {
      const result = await someApiResult();
      setAction(result);
    } catch (error) {
      //do somethings with the error
    }
  }

  useEffect(()=&amp;gt;{
    someAsyncFunction();
  }, []); // can be called with or without the array literal

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;ul&amp;gt;
        ToDo:
        &amp;lt;li&amp;gt;{action}&amp;lt;/li&amp;gt;
      &amp;lt;/ul&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Rules of React Hooks
&lt;/h2&gt;

&lt;p&gt;The React &lt;a href="https://reactjs.org/docs/hooks-rules.html"&gt;documentation&lt;/a&gt; outlines a few rules to ensure best practice for your application.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use functional components&lt;/li&gt;
&lt;li&gt;It is okay to use multiple State and Effect Hooks in a single component, just outline your Hooks in the order in which they should be called.&lt;/li&gt;
&lt;li&gt;This is why Hooks must be called on the top level of our components.&lt;/li&gt;
&lt;li&gt;Hooks should not be used inside of loops, conditions, or nested functions&lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;I hope you enjoyed this brief introduction. You could always read more on React Hooks documentation.&lt;/p&gt;

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