<?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: JulianneHuynh</title>
    <description>The latest articles on DEV Community by JulianneHuynh (@juliannehuynh).</description>
    <link>https://dev.to/juliannehuynh</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%2F975680%2F7e9d074a-e171-4ea9-8b64-1de0462fdc72.png</url>
      <title>DEV Community: JulianneHuynh</title>
      <link>https://dev.to/juliannehuynh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juliannehuynh"/>
    <language>en</language>
    <item>
      <title>useContext in React JS</title>
      <dc:creator>JulianneHuynh</dc:creator>
      <pubDate>Thu, 16 Feb 2023 17:56:34 +0000</pubDate>
      <link>https://dev.to/juliannehuynh/usecontext-in-react-js-28mo</link>
      <guid>https://dev.to/juliannehuynh/usecontext-in-react-js-28mo</guid>
      <description>&lt;p&gt;Normally, you would manually pass state down as a prop from a parent component to each child component. However, passing the prop down would become tedious if the child component had nested components. To solve this issue, you can use the &lt;strong&gt;useContext&lt;/strong&gt; hook in React, which provides state from a parent component to the child component, no matter how deeply nested it may be. To use &lt;strong&gt;useContext&lt;/strong&gt;, you first create a context object using the &lt;strong&gt;createContext&lt;/strong&gt; function, where the initial value is used as an argument. The context object has two parts: the &lt;strong&gt;provider&lt;/strong&gt;, which wraps around the code that requires access to that information in the context, and a value set to the context used. In the child component, you can import the value prop using &lt;strong&gt;value = useContext(xContext)&lt;/strong&gt;. All components wrapped within the &lt;strong&gt;provider&lt;/strong&gt; will have access to the value prop.&lt;/p&gt;

</description>
      <category>management</category>
      <category>career</category>
      <category>agile</category>
      <category>discuss</category>
    </item>
    <item>
      <title>Routing with Rails</title>
      <dc:creator>JulianneHuynh</dc:creator>
      <pubDate>Thu, 26 Jan 2023 07:02:00 +0000</pubDate>
      <link>https://dev.to/juliannehuynh/routing-with-rails-18fg</link>
      <guid>https://dev.to/juliannehuynh/routing-with-rails-18fg</guid>
      <description>&lt;p&gt;&lt;strong&gt;Routing:&lt;/strong&gt;&lt;br&gt;
When you go out to a restaurant you place an order with your waiter, your waiter then puts that order in, and the kitchen prepares your order. Once the kitchen is done preparing your order, the waiter brings your order to you. This concept applies similarly when a client utilizes the internet. A client makes a request to the server(backend) and the server returns data back to the client(frontend).&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykzn040e3sr01kj6i9cl.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fykzn040e3sr01kj6i9cl.PNG" alt="Image description" width="767" height="322"&gt;&lt;/a&gt;&lt;br&gt;&lt;br&gt;
&lt;strong&gt;Routing with Rails:&lt;/strong&gt;&lt;br&gt;
Ruby on rails allows programmers to use the 7 different routes to execute the different action methods mapped to the object within the app&amp;gt;controllers.rb. Custom routing are created in config&amp;gt;routes.rb where resources also are used.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhlhycni86rh8yq8x7uc.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxhlhycni86rh8yq8x7uc.PNG" alt="Image description" width="800" height="339"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Custom Routing:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fil33k5sbf2ltszpzzbrp.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fil33k5sbf2ltszpzzbrp.PNG" alt="Image description" width="623" height="187"&gt;&lt;/a&gt;&lt;br&gt;
When a client puts a request into the application for '/lawyers/:id', the request fetches the custom method of lawyer in the app&amp;gt;controller&amp;gt;users_controller.rb. &lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Few5vxq811f9xg9u60chw.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Few5vxq811f9xg9u60chw.PNG" alt="Image description" width="725" height="243"&gt;&lt;/a&gt;&lt;br&gt;
Here, user is set to a variable and active record rescue_from is used as our error handling when .find is used. To check if the routing was successfully created use Postman to test route:&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgdgi8fkqkqvbhnsj9e3.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Frgdgi8fkqkqvbhnsj9e3.PNG" alt="Image description" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Custom Route Works!!! &lt;/p&gt;

</description>
      <category>ai</category>
      <category>discuss</category>
      <category>productivity</category>
    </item>
    <item>
      <title>Making Asynchronous Requests with Promise and Await Functions</title>
      <dc:creator>JulianneHuynh</dc:creator>
      <pubDate>Sun, 11 Dec 2022 00:30:26 +0000</pubDate>
      <link>https://dev.to/juliannehuynh/making-asynchronous-requests-with-promise-and-await-functions-3cb9</link>
      <guid>https://dev.to/juliannehuynh/making-asynchronous-requests-with-promise-and-await-functions-3cb9</guid>
      <description>&lt;p&gt;The promise method was introduced before the await method to make an asynchronous request for fetching data. It handles asynchronous requests with an initial state that needs time to process to return a value. When the request is done pending, it will either return a fulfilled value or an error causing an incomplete operation.&lt;/p&gt;

&lt;p&gt;In this example, the declared terms state variable is passed to the useEffect hook which then becomes the effect that makes the asynchronous request. The callback function is called on once by including an empty dependency array. If the array was not included the function would constantly render. The fetchPromise variable is given a function using an axios request library. This will make an asynchronous request to the JSON. The .then method is used to obtain the data that responds in objects with key.values . A catch block can be used to identify any errors along the way.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5rcse882gd70185rgpw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Ft5rcse882gd70185rgpw.png" alt="Image description" width="578" height="457"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;When promises begin to accumulate it becomes difficult to follow. The async function is more organized and basically the same code as the promise method. The await keyword is used to wait for the promise to be processed first before proceeding. JavaScript requires that the await method can only be used within an async() function. To catch errors, wrap the entire function with a try-catch block. Utilizing the async/await, it's an easier and cleaner way for syntax to flow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8shciqtjdgagni6lxsi.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq8shciqtjdgagni6lxsi.PNG" alt="Image description" width="763" height="485"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>welcome</category>
    </item>
    <item>
      <title>Randomizing Array Elements</title>
      <dc:creator>JulianneHuynh</dc:creator>
      <pubDate>Mon, 21 Nov 2022 14:14:30 +0000</pubDate>
      <link>https://dev.to/juliannehuynh/randomizing-array-elements-21o5</link>
      <guid>https://dev.to/juliannehuynh/randomizing-array-elements-21o5</guid>
      <description>&lt;p&gt;If the Math.random() function didn't work for you it's okay. As a newbie to coding, it took me over a day for it to work it's magic. There are a number of ways to create a random return but I found this to be the cleanest way that made the most sense. The syntax behind this code may seem a little dauting but once you break it down it's much simpler than you think. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iyGby3Q7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wqghvhn7seifywxixf9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iyGby3Q7--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/2wqghvhn7seifywxixf9.png" alt="Image description" width="880" height="203"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here we have an array of dog names. In order to randomize the dogs' names the function was called on the array, dogs. The function Math.floor(), essentially rounds down an integer, but since these are names it won't return just a quarter of the name. To generate a random return of an element of the array Math.random() is multiplied to the length of the array, array.length. The length covers the entirety of the array of all the elements. &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>vscode</category>
      <category>programming</category>
      <category>firstpost</category>
    </item>
  </channel>
</rss>
