<?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: Dillon</title>
    <description>The latest articles on DEV Community by Dillon (@dillpap).</description>
    <link>https://dev.to/dillpap</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%2F1001352%2F4150d72b-84c2-4710-aa8a-5feb0d592698.png</url>
      <title>DEV Community: Dillon</title>
      <link>https://dev.to/dillpap</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/dillpap"/>
    <language>en</language>
    <item>
      <title>Getting Hooked on React</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Tue, 21 Feb 2023 21:47:55 +0000</pubDate>
      <link>https://dev.to/dillpap/getting-hooked-on-react-3l8g</link>
      <guid>https://dev.to/dillpap/getting-hooked-on-react-3l8g</guid>
      <description>&lt;p&gt;Hooks are special functions. Hooks CAN ONLY be called inside the body of a function component. &lt;/p&gt;

&lt;p&gt;Rules of Hooks:&lt;/p&gt;

&lt;p&gt;Thou shalt call the Hook within the scope of a react application. &lt;br&gt;
Thou shalt call your hooks from the toop level of the component. (this error would call if you were to try to call your hook in a conditional. it doesn't like this because calling it within a conditional means that you could simply not call it in a specific case.)  &lt;/p&gt;

&lt;p&gt;useState - enables us to hook into the component's state&lt;br&gt;
useId - enables us to store a unique identifier on the component instance&lt;/p&gt;

&lt;p&gt;You should not mess with or try to update state. &lt;/p&gt;

&lt;p&gt;In javascript, you could do this, but it is a big "no-no" in react. &lt;/p&gt;

&lt;p&gt;React.useRef(initial value) -- if you leave this blank, it is undefined.&lt;/p&gt;

&lt;p&gt;React states shouldn't be mutated, react refs are meant to be mutated.  &lt;/p&gt;

&lt;p&gt;Refs are an object to what is being referred. So, if you are calling a funciton using useRef, you have to slide in the refName.current.value to get to the value you want. Otherwise, you aren't getting past the {current: "whatever"}&lt;/p&gt;

</description>
    </item>
    <item>
      <title>State</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Mon, 20 Feb 2023 15:45:01 +0000</pubDate>
      <link>https://dev.to/dillpap/state-255d</link>
      <guid>https://dev.to/dillpap/state-255d</guid>
      <description>&lt;p&gt;State - used for values that change over time. &lt;/p&gt;

&lt;p&gt;useState creates state variables&lt;/p&gt;

&lt;p&gt;useState takes a single value, which is the base state, initial value. &lt;/p&gt;

&lt;p&gt;React.useState(0);&lt;/p&gt;

&lt;p&gt;useState is a hook&lt;/p&gt;

&lt;p&gt;useState returns an array with current value of state variable and a funciton you can use to update the astate variable&lt;/p&gt;

&lt;p&gt;in the example of Jonny Appleseed's apple counter you would have the following syntax&lt;/p&gt;

&lt;p&gt;function Appledieapp() {&lt;br&gt;
  const [apple, setApple] = React.useState(0);&lt;br&gt;
   return (&lt;br&gt;
     setApple(apple + 1)}&amp;gt;&lt;br&gt;
         Apples: {apple}&lt;br&gt;
     &lt;br&gt;
);&lt;br&gt;
}&lt;/p&gt;

</description>
      <category>pcgaming</category>
      <category>multiplayer</category>
    </item>
    <item>
      <title>Wrapper Function</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Mon, 20 Feb 2023 00:27:42 +0000</pubDate>
      <link>https://dev.to/dillpap/wrapper-function-2o9b</link>
      <guid>https://dev.to/dillpap/wrapper-function-2o9b</guid>
      <description>&lt;p&gt;If you want to specify arguments for a function, you need to use the wrapper function &lt;/p&gt;

&lt;p&gt;it looks like this...&lt;/p&gt;

&lt;p&gt;if the function were to be called by clicking a button&lt;/p&gt;

&lt;p&gt;function thisFunctionName(param){&lt;br&gt;
stuff the function does&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt; thisFunctionName('param')}&amp;gt;&lt;br&gt;
Button text&lt;br&gt;
&lt;/p&gt;

</description>
    </item>
    <item>
      <title>A Kafka Object Metamorphizes Into An Array</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Sun, 19 Feb 2023 22:42:23 +0000</pubDate>
      <link>https://dev.to/dillpap/a-kafka-object-metamorphizes-into-an-array-5d90</link>
      <guid>https://dev.to/dillpap/a-kafka-object-metamorphizes-into-an-array-5d90</guid>
      <description>&lt;p&gt;Object.keys&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This pulls the keys of an object and puts them into an array. 
for ex. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;{flavor: cherry,&lt;br&gt;
price: 12.99,&lt;br&gt;
size: large}&lt;br&gt;
Object.values&lt;br&gt;
Object.entries&lt;/p&gt;

</description>
      <category>programming</category>
      <category>career</category>
      <category>codenewbie</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Iterating over object data</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Fri, 17 Feb 2023 02:15:48 +0000</pubDate>
      <link>https://dev.to/dillpap/iterating-over-object-data-5hld</link>
      <guid>https://dev.to/dillpap/iterating-over-object-data-5hld</guid>
      <description>&lt;p&gt;To convert object data into array data, there are three different ways.&lt;/p&gt;

&lt;p&gt;Object.keys(), Object.values(), Object.entries()&lt;/p&gt;

&lt;p&gt;Object.keys(arrayName) will return an array of the keys in the object.&lt;/p&gt;

&lt;p&gt;Object.values(arrayName) will return an array of the values in the object.&lt;/p&gt;

&lt;p&gt;Object.entries(arrayName) will return an array of the key-value pairs in the object.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fragments</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Thu, 16 Feb 2023 16:11:29 +0000</pubDate>
      <link>https://dev.to/dillpap/fragments-384m</link>
      <guid>https://dev.to/dillpap/fragments-384m</guid>
      <description>&lt;p&gt;Fragments are special components that do not produce DOM nodes. &lt;/p&gt;

&lt;p&gt;The syntax is pretty similar to normal function, except...&lt;/p&gt;

&lt;p&gt;function Whatever(){&lt;br&gt;
 return (&lt;br&gt;
   &lt;br&gt;
   &lt;/p&gt;
&lt;h3&gt;What you want&lt;/h3&gt;
&lt;br&gt;
   &lt;p&gt; Baby I got it &lt;/p&gt;
&lt;br&gt;
    &lt;br&gt;
  );&lt;br&gt;
}

&lt;p&gt;export default Whatever; &lt;/p&gt;

&lt;p&gt;In lieu of the  open and close tags, you can just have &amp;lt;&amp;gt;&amp;lt;/&amp;gt;. &lt;/p&gt;

&lt;p&gt;***This is the way to overcome the error Adjacent JSX elements must be wrapped in an enclosing tag. Did you want a JSX fragment &amp;lt;&amp;gt;...&amp;lt;/&amp;gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React Application Structure</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Thu, 16 Feb 2023 02:12:56 +0000</pubDate>
      <link>https://dev.to/dillpap/react-application-structure-3jfp</link>
      <guid>https://dev.to/dillpap/react-application-structure-3jfp</guid>
      <description>&lt;p&gt;For the most part, React apps have a common structure. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;index.js
This is best thought of as a the place where the first bit of code is executed. You also call createRoot and render from react-dom here. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This file typically renders  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;App.js
This is kind of the floor plan or the schematics of the app. &lt;/li&gt;
&lt;li&gt;Modules&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>REDUCE for Array</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Thu, 16 Feb 2023 01:27:54 +0000</pubDate>
      <link>https://dev.to/dillpap/reduce-for-array-19di</link>
      <guid>https://dev.to/dillpap/reduce-for-array-19di</guid>
      <description>&lt;p&gt;.reduce()&lt;/p&gt;

&lt;p&gt;Reduce iterates over array elements. Reduce needs one additional argument. &lt;/p&gt;

&lt;p&gt;books.reduce((accumulator, otherParam) =&amp;gt; {&lt;br&gt;
   return accumulator; &lt;/p&gt;

&lt;p&gt;}, 0); the 0 here is the starting point or what gets iterated over.&lt;/p&gt;

&lt;p&gt;If we wanted to count up the number of books sold from among our array, we would have the following...&lt;/p&gt;

&lt;p&gt;const books = [&lt;br&gt;
{title: The Great Gatsby, author: Fitzgerald, sales: 2},&lt;br&gt;
{title: Odyssey, author: Homer, sales: 1889},&lt;br&gt;
{title: Hyacinth, author: Julien Linde, sales: 275},&lt;br&gt;
{title: Goldfinch, author: Tart, sales: 1089}&lt;br&gt;
];&lt;/p&gt;

&lt;p&gt;const bookSales = books.reduce((accumulator, book) =&amp;gt; {&lt;/p&gt;

&lt;p&gt;return accumulator + book.sales;&lt;/p&gt;

&lt;p&gt;}, 0);&lt;/p&gt;

&lt;p&gt;console.log(bookSales) &lt;/p&gt;

</description>
      <category>gratitude</category>
    </item>
    <item>
      <title>MAP, MAP, MAP</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Thu, 16 Feb 2023 00:32:35 +0000</pubDate>
      <link>https://dev.to/dillpap/map-map-map-37e3</link>
      <guid>https://dev.to/dillpap/map-map-map-37e3</guid>
      <description>&lt;p&gt;.map&lt;/p&gt;

&lt;p&gt;Let's Goooooooooo&lt;/p&gt;

&lt;p&gt;Map can transform the array. It doesn't change or mutate the old one, it creates a new one.  &lt;/p&gt;

&lt;p&gt;you can do this really neat thing with arrays where you can utilize the .map feature to add only to those nested objects where a certain criteria is met, the ones that don't meet the criteria don't have any value added, not even to say that it is false. &lt;/p&gt;

&lt;p&gt;say you have an array of books. Each book has a objects that have its title, author, and number of sales. from number of sales you know that if the total sales exceeded 100 (sales in thousands), it was a best seller. &lt;/p&gt;

&lt;p&gt;here's the code that would allow you to add in the value if the object should have the best seller line added. &lt;/p&gt;

&lt;p&gt;const books = [&lt;br&gt;
{title: The Great Gatsby, author: Fitzgerald, sales: 2},&lt;br&gt;
{title: Odyssey, author: Homer, sales: 1889},&lt;br&gt;
{title: Hyacinth, author: Julien Linde, sales: 275},&lt;br&gt;
{title: Goldfinch, author: Tart, sales: 1089}&lt;br&gt;
];&lt;/p&gt;

&lt;p&gt;const updatedBooks = books.map(book=&amp;gt; book.sales &amp;gt; 100 ? {...book, bestSeller: true} : book);cons&lt;/p&gt;

&lt;p&gt;console.log(updatedBooks)&lt;/p&gt;

&lt;p&gt;btws... you will have to add in quotes around the author and title values &lt;/p&gt;

&lt;p&gt;.forEach() &lt;/p&gt;

&lt;p&gt;This is powerful and lets us work off the arrays we have built. &lt;/p&gt;

&lt;p&gt;Using the array we created above with the bestSeller value included, we can alert the user if the book was a best seller. We will demonstrate chaining here. &lt;/p&gt;

&lt;p&gt;books.map(book=&amp;gt; book.sales &amp;gt; 100 ? {...book, bestSeller: true} : book).forEach(book =&amp;gt; {&lt;br&gt;
if (book.bestSeller) {&lt;br&gt;
  console.log(&lt;code&gt;${book.title} written by ${book.author} was a best seller!!&lt;/code&gt;&lt;br&gt;
   }&lt;/p&gt;

&lt;p&gt;})&lt;/p&gt;

</description>
    </item>
    <item>
      <title>React Application Structure</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Wed, 15 Feb 2023 23:51:00 +0000</pubDate>
      <link>https://dev.to/dillpap/react-application-structure-2k8j</link>
      <guid>https://dev.to/dillpap/react-application-structure-2k8j</guid>
      <description>&lt;p&gt;For the most part, React apps have a common structure. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;index.js
This is best thought of as a the place where the first bit of code is executed. You also call createRoot and render from react-dom here. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;This file typically renders  &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;App.js
This is kind of the floor plan or the schematics of the app.&lt;/li&gt;
&lt;li&gt;Modules&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>welcome</category>
    </item>
    <item>
      <title>My Learning React Notes</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Tue, 14 Feb 2023 21:39:35 +0000</pubDate>
      <link>https://dev.to/dillpap/my-learning-react-notes-1oo0</link>
      <guid>https://dev.to/dillpap/my-learning-react-notes-1oo0</guid>
      <description>&lt;p&gt;.js in React files have the following format &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;IMPORTS
This is where you put stuff you are importing.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;import React from 'react';&lt;br&gt;
import {createRoot} from 'react-dom/client';&lt;/p&gt;

&lt;p&gt;***note for mobile, it is react-native &lt;br&gt;
react-dom is for the web&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;The Element&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;How to create a react element&lt;/p&gt;

&lt;p&gt;cont elementName = React.createElement(&lt;/p&gt;

&lt;p&gt;)&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;EXPORTS
const contaier = document.querySelector('#root')
&lt;em&gt;**This is basically the instruction telling it where to go.
*&lt;/em&gt;&lt;em&gt;the page(s) where you want to put this element say this is where they go by your putting #root in. 
const root = createRoot(container);
*&lt;/em&gt;*you have to create the container that the element will go in. 
root.render(element);&lt;/li&gt;
&lt;/ol&gt;

</description>
      <category>testing</category>
      <category>webperf</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Understanding Arrays</title>
      <dc:creator>Dillon</dc:creator>
      <pubDate>Tue, 14 Feb 2023 16:28:47 +0000</pubDate>
      <link>https://dev.to/dillpap/understanding-arrays-43f0</link>
      <guid>https://dev.to/dillpap/understanding-arrays-43f0</guid>
      <description>&lt;p&gt;To create an array &lt;/p&gt;

&lt;p&gt;const = arrayName = [];&lt;/p&gt;

&lt;p&gt;To add items to an array, you can use the .push &lt;/p&gt;

&lt;p&gt;myToDoList.push(todoA, todoB);&lt;/p&gt;

&lt;p&gt;alternatively you could do &lt;br&gt;
myToDoList.push(todoA);&lt;br&gt;
myToDoList.push(todoB);&lt;br&gt;
myToDoList.push(todoc);&lt;/p&gt;

&lt;p&gt;to return the last item &lt;/p&gt;

&lt;p&gt;console.log(myToDoList.[myTodoList.length-1])&lt;/p&gt;

&lt;p&gt;to remove the last item&lt;/p&gt;

&lt;p&gt;myToDoList.pop();&lt;/p&gt;

</description>
      <category>php</category>
      <category>backenddevelopment</category>
      <category>career</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
