<?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: Kirsty</title>
    <description>The latest articles on DEV Community by Kirsty (@ofthewildfire).</description>
    <link>https://dev.to/ofthewildfire</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%2F1559892%2Fe24bcb29-b456-4ee4-86f3-7eef3b34ede3.jpg</url>
      <title>DEV Community: Kirsty</title>
      <link>https://dev.to/ofthewildfire</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ofthewildfire"/>
    <language>en</language>
    <item>
      <title>JavaScript String Manipulation: How to Use Split, Reverse, and Join</title>
      <dc:creator>Kirsty</dc:creator>
      <pubDate>Fri, 11 Oct 2024 22:05:53 +0000</pubDate>
      <link>https://dev.to/ofthewildfire/javascript-string-manipulation-how-to-use-split-reverse-and-join-4ojf</link>
      <guid>https://dev.to/ofthewildfire/javascript-string-manipulation-how-to-use-split-reverse-and-join-4ojf</guid>
      <description>&lt;h3&gt;
  
  
  Introduction
&lt;/h3&gt;

&lt;p&gt;In this article, we will look at three JavaScript methods: &lt;code&gt;split()&lt;/code&gt;, &lt;code&gt;reverse()&lt;/code&gt;, and &lt;code&gt;join()&lt;/code&gt;. These methods are helpful for working with strings and carrying out tasks such as reversing text or changing the order of words.&lt;/p&gt;

&lt;h3&gt;
  
  
  Prerequisites
&lt;/h3&gt;

&lt;p&gt;No prior experience is needed—just a willingness to dive into JavaScript and experiment with these methods.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;split()&lt;/code&gt; Method
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;split()&lt;/code&gt; method breaks a string into an array based on a specified delimiter, which is passed as an argument. The delimiter tells the program where to "cut" the string. For example, if you have a sentence like "This is a lovely sandwich" and you want to break it into individual words, you can use a space (&lt;code&gt;' '&lt;/code&gt;) as the delimiter.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This is a lovely sandwich&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;splitString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;string&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;When you provide a space (&lt;code&gt;' '&lt;/code&gt;) as the argument, the code looks for that space in the string and "splits" the string at each occurrence. This creates an array, where each word becomes an individual element.&lt;/p&gt;

&lt;p&gt;The result of the above code is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;This&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="s2"&gt;is&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="s2"&gt;a&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="s2"&gt;lovely&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="s2"&gt;sandwich&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty neat, right?&lt;/p&gt;

&lt;p&gt;You can use any delimiter you want. For instance, if you have a hyphenated string like "hi-there-how-are-you-doing!" and you want to split it by hyphens, just use &lt;code&gt;'-'&lt;/code&gt; as the delimiter:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;hyphen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi-there-how-are-you-doing!&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;splitHyphen&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;hyphen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;split&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;-&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This results in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nc"&gt;Array&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi&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="s2"&gt;there&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="s2"&gt;how&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="s2"&gt;are&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="s2"&gt;you&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="s2"&gt;doing!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This method opens up many possibilities for manipulating strings. But now, you might be thinking: &lt;em&gt;Okay, that’s great, but I started with a string and now I have an array. How do I get my string back?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Let’s move on to the next method.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;join()&lt;/code&gt; Method
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;join()&lt;/code&gt; method can be used on an array to turn it back into a string. Just like &lt;code&gt;split()&lt;/code&gt;, the &lt;code&gt;join()&lt;/code&gt; method takes an argument that specifies how to join the array elements. The difference is that instead of breaking a string, &lt;code&gt;join()&lt;/code&gt; uses the argument to combine the array elements back into a single string.&lt;/p&gt;

&lt;p&gt;For example, using the &lt;code&gt;splitHyphen&lt;/code&gt; array from earlier, you can join it back into a string by providing a space as the argument:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;joinedString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;splitHyphen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This results in:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;hi there how are you doing!&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It’s like magic! Now your array is transformed back into a string, with spaces between each word.&lt;/p&gt;

&lt;h3&gt;
  
  
  The &lt;code&gt;reverse()&lt;/code&gt; Method
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;reverse()&lt;/code&gt; method changes the order of elements in an array to be the opposite of what it was. This method is called directly on the array, without any arguments, and it simply reverses the order of the elements.&lt;/p&gt;

&lt;p&gt;For example, if you want to reverse the elements in the &lt;code&gt;splitHyphen&lt;/code&gt; array, you can do this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reversedArray&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;splitHyphen&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;reverse&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="p"&gt;[&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;doing!&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="s2"&gt;you&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="s2"&gt;are&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="s2"&gt;how&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="s2"&gt;there&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="s2"&gt;hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt; &lt;span class="p"&gt;]&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;You can even use &lt;code&gt;join()&lt;/code&gt; again to turn this reversed array back into a string:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="nx"&gt;reversedString&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;reversedArray&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This gives you:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;doing! you are how there hi&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Pretty cool, right?&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;In this article, we explored three essential methods in JavaScript: &lt;code&gt;split()&lt;/code&gt;, &lt;code&gt;reverse()&lt;/code&gt;, and &lt;code&gt;join()&lt;/code&gt;. We looked at how they work together to manipulate strings and arrays, transforming them in flexible ways. I hope this helps you in your JavaScript journey and inspires you to experiment further!&lt;/p&gt;




&lt;p&gt;Thank you for reading! If you have any questions or want to share your thoughts on JavaScript string manipulation, feel free to reach out to me on Twitter &lt;a href="https://twitter.com/km_fsdev" rel="noopener noreferrer"&gt;@km_fsdev&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>A Week of React Learning: Key Takeaways and Future Plans</title>
      <dc:creator>Kirsty</dc:creator>
      <pubDate>Sat, 15 Jun 2024 20:00:37 +0000</pubDate>
      <link>https://dev.to/ofthewildfire/a-week-of-react-learning-key-takeaways-and-future-plans-1pba</link>
      <guid>https://dev.to/ofthewildfire/a-week-of-react-learning-key-takeaways-and-future-plans-1pba</guid>
      <description>&lt;p&gt;This week has been a fun week; it's my first week without any assignments for computer science and purely a week where I learned all sorts of React jazz. ✨&lt;/p&gt;

&lt;p&gt;Not to mention, this week was the first week where I considered myself officially back on my &lt;strong&gt;100Devs&lt;/strong&gt; community-taught journey. &lt;/p&gt;

&lt;h2&gt;
  
  
  This week I learned:
&lt;/h2&gt;

&lt;p&gt;This week, my focus was entirely on React. Here’s what I learned: &lt;/p&gt;

&lt;h3&gt;
  
  
  Fetching data in React
&lt;/h3&gt;

&lt;p&gt;Having done Scrimba when I first started learning I knew something about fetching data within React, but, I could easily have failed to answer you, this week I fixed my tech debt knowledge about fetching data in a React application. &lt;/p&gt;

&lt;p&gt;To start with I got a refresher crash course on the &lt;strong&gt;Fetch API&lt;/strong&gt;. It was something I knew and understood how to use, from a JavaScript point of view. The &lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/fetch" rel="noopener noreferrer"&gt;&lt;strong&gt;Fetch API&lt;/strong&gt;&lt;/a&gt; not being part of the JavaScript language, but, is a Web API. Having absolutely nothing to do with the JavaScript specification, and only exists due to the environment in which we are running our code - &lt;strong&gt;the browser&lt;/strong&gt; - which was a wonderful refresher. It is something I am wildly fascinated by. &lt;/p&gt;

&lt;p&gt;What I learned about fetching data in React is that the &lt;strong&gt;&lt;a href="https://react.dev/reference/react/useEffect" rel="noopener noreferrer"&gt;useEffect&lt;/a&gt;&lt;/strong&gt; hook is required to fetch data, this is because: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;without a useEffect hook we can run into infinite loops, and I tested it, it can just keep running, which is not a good thing. &lt;/li&gt;
&lt;li&gt;Fetching data from an external point is a &lt;em&gt;side-effect&lt;/em&gt; - and React has no way of handling this asynchronous behaviour. However, with the useEffect hook, we can handle side-effects, this is the entire purpose of the &lt;strong&gt;useEffect&lt;/strong&gt; hook in the first place. &lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;useEffect&lt;br&gt;
&lt;code&gt;useEffect&lt;/code&gt; is a React Hook that lets you &lt;a href="https://react.dev/learn/synchronizing-with-effects" rel="noopener noreferrer"&gt;synchronize a component with an external system.&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;In the case of fetching data - you need to synchronise the data you have received with your application, also likely, as I have been doing in my tests, using the &lt;strong&gt;useState&lt;/strong&gt; hook. &lt;/p&gt;

&lt;p&gt;I want to use this in my &lt;strong&gt;RecipeFinder&lt;/strong&gt; project. :) &lt;/p&gt;

&lt;h2&gt;
  
  
  useReducer hook
&lt;/h2&gt;

&lt;p&gt;I am still struggling with the useReducer hook, but the basics I have understood are: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;it's like a super-powered useState&lt;/li&gt;
&lt;li&gt;using useReducer is best when the state is complex, eg. an object with various properties. &lt;/li&gt;
&lt;li&gt;it takes two arguments, an initial state, just as useState does, and then a second, an action argument, this action argument is what gives useReducer its &lt;strong&gt;super powered&lt;/strong&gt; juice, using this second argument we can update state more efficiently based on actions in our code, which would reduce complexity and errors. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I still have to read and practice more with it. :) &lt;/p&gt;

&lt;h2&gt;
  
  
  Children in React
&lt;/h2&gt;

&lt;p&gt;I had a crash course on JSX - JSX is just JavaScript under the hood. &lt;/p&gt;

&lt;p&gt;It is objects - and I learned that React transpiles its JSX to these objects and it has a hierarchy of children, which are a representation of the DOM nodes that are rendered to the UI. &lt;/p&gt;

&lt;p&gt;In doing this, I used Babel a lot. &lt;/p&gt;

&lt;p&gt;Look how cool it is, the React component and what it transpiles to.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;div&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; 
    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h1&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;Hiya&lt;/span&gt; &lt;span class="nx"&gt;world&lt;/span&gt;&lt;span class="o"&gt;!&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/h1&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;    &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nx"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nx"&gt;oh&lt;/span&gt; &lt;span class="nx"&gt;a&lt;/span&gt; &lt;span class="nx"&gt;nested&lt;/span&gt; &lt;span class="nx"&gt;child&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/span&amp;gt; &amp;lt;/&lt;/span&gt;&lt;span class="nx"&gt;h2&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/div&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="sr"&gt;/MyComponent&lt;/span&gt;&lt;span class="err"&gt;&amp;gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nx"&gt;jsx&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;_jsx&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;jsxs&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;_jsxs&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;react/jsx-runtime&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="cm"&gt;/*#__PURE__*/&lt;/span&gt; &lt;span class="nf"&gt;_jsx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;MyComponent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="cm"&gt;/*#__PURE__*/&lt;/span&gt; &lt;span class="nf"&gt;_jsxs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;div&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="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
      &lt;span class="cm"&gt;/*#__PURE__*/&lt;/span&gt; &lt;span class="nf"&gt;_jsx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h1&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="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; Hiya world! &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
      &lt;span class="p"&gt;}),&lt;/span&gt;
      &lt;span class="cm"&gt;/*#__PURE__*/&lt;/span&gt; &lt;span class="nf"&gt;_jsxs&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;h2&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="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
          &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt; &lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
          &lt;span class="cm"&gt;/*#__PURE__*/&lt;/span&gt; &lt;span class="nf"&gt;_jsx&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;span&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="na"&gt;children&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;Oh a nested child &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="s2"&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="p"&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;Not to mention I also got a nice exploration on the React Children prop, which, despite being listed as something that increases the risk of fragile code, is something I find cool. &lt;/p&gt;

&lt;p&gt;Along with the Children prop, I learned the &lt;strong&gt;Children.map&lt;/strong&gt; to transform Children in React, almost exactly how the &lt;strong&gt;map&lt;/strong&gt; functions in vanilla JavaScript. &lt;/p&gt;

&lt;p&gt;I like the pattern. It allows for really nice dynamic manipulation of children elements. I haven't used it much outside of the study lesson though. :) Soon. TM. &lt;/p&gt;

&lt;h2&gt;
  
  
  Custom hooks
&lt;/h2&gt;

&lt;p&gt;I recall seeing "Custom Hooks" in the title of a YouTube video once, I didn't know much about hooks then, all I knew then was useState and the idea of a custom hook horrified me. &lt;/p&gt;

&lt;p&gt;I was wrong. &lt;/p&gt;

&lt;p&gt;Custom hooks are freaking awesome. &lt;/p&gt;

&lt;p&gt;A custom hook is a module in React. It allows you to create a hook that performs a specific functionality all bundled up into a hook. This means you can share and use this hook anywhere in your code if you need it. &lt;/p&gt;

&lt;p&gt;Reducing code duplication. &lt;/p&gt;

&lt;h3&gt;
  
  
  Higher-order components and render props
&lt;/h3&gt;

&lt;p&gt;I noticed something this week as I was learning React. &lt;/p&gt;

&lt;p&gt;A lot of React patterns/code revolve around reducing code duplication. Higher-order components and render props do exactly this. &lt;/p&gt;

&lt;p&gt;With Higher order components we have a component and then we return a new one from our higher order one and this new component has extra features. It's an interesting pattern I have to explore more, but the general idea is: &lt;/p&gt;

&lt;p&gt;When certain React logic is being reused a higher-order component might be a better option because it will reduce the code repetition, and then you can use that same higher-order component to implement similar logic in a different part of the application by returning a different component and modifying it to your use case. &lt;/p&gt;

&lt;p&gt;Render props function much the same way, however, instead, they return a render() method with the data of the new component/data. &lt;/p&gt;

&lt;h3&gt;
  
  
  Portfolio time...
&lt;/h3&gt;

&lt;p&gt;I also started a revamp of my portfolio. &lt;/p&gt;

&lt;p&gt;I have been using a template &amp;amp; that is cool and great, it's neat, and it's functional, and I likely will go back to one, but, I am making my own right now. I am using React. &lt;/p&gt;

&lt;p&gt;The goal is to implement a lot of the features and code I have learned. &lt;/p&gt;

&lt;p&gt;Learning about context API and how it can be used to toggle between themes was super exciting and I would like to make several for my portfolio. My fear is the design and probably this means I will hunt for a Figma design file and code it myself. &lt;/p&gt;

&lt;p&gt;This seems like a better idea to me. &lt;/p&gt;

&lt;h2&gt;
  
  
  Extras
&lt;/h2&gt;

&lt;p&gt;A few extras I did this week: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I had a coffee chat with a front-end developer and it was pretty wonderful. I learned a lot from this person and got so many ideas, namely sharing my work and not learning in a vacuum, this is common advice and I have been working on that. &lt;/li&gt;
&lt;li&gt;Their advice was to leverage LinkedIn as well, I am terrible at LinkedIn but, I will start to use it more. :) &lt;/li&gt;
&lt;/ul&gt;

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

&lt;p&gt;Overall a wonderful week with React and I look forward to more, next week is Scrimba and I am super excited to dive into it and work on the projects. Will be super fun. &lt;/p&gt;

&lt;p&gt;This is just the beginning. I am truly super excited to continue this journey. &lt;/p&gt;

&lt;p&gt;More of my journey on ✨ &lt;a href="https://x.com/km_fsdev" rel="noopener noreferrer"&gt;X/Twitter&lt;/a&gt; ✨&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>react</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
