<?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: Jaelyn Lee</title>
    <description>The latest articles on DEV Community by Jaelyn Lee (@jaelynlee).</description>
    <link>https://dev.to/jaelynlee</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%2F1128039%2F7375ae47-9441-4b1c-ae7c-90f4df59e5f9.jpeg</url>
      <title>DEV Community: Jaelyn Lee</title>
      <link>https://dev.to/jaelynlee</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/jaelynlee"/>
    <language>en</language>
    <item>
      <title>How to make programming a habit in your life</title>
      <dc:creator>Jaelyn Lee</dc:creator>
      <pubDate>Sun, 16 Jun 2024 09:21:45 +0000</pubDate>
      <link>https://dev.to/jaelynlee/how-to-make-programming-a-habit-in-your-life-1m3l</link>
      <guid>https://dev.to/jaelynlee/how-to-make-programming-a-habit-in-your-life-1m3l</guid>
      <description>&lt;p&gt;Hi Devs,&lt;/p&gt;

&lt;p&gt;As a graduate developer trying to get my foot in the door of the IT industry, making programming a habit is crucial.&lt;/p&gt;

&lt;p&gt;You need to consistently make commits to your GitHub, work on new projects with the new tech stack you learn, update your portfolio and so on! But I always think, &lt;em&gt;"Why did I end up scrolling on my phone all day? I've wasted my time again."&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Why is it so hard to make programming a habit and how can we change our bad habit into a good one?&lt;br&gt;
 &lt;br&gt;
 &lt;/p&gt;

&lt;h3&gt;
  
  
  We first need to know what a habit is.
&lt;/h3&gt;

&lt;p&gt;According to the Oxford Dictionary, a habit is a settled or regular tendency or practice, &lt;strong&gt;especially one that is hard to give up.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In his book, The Power of Habit, Charles Duhigg defines a habit as an unconscious action, such as brushing your teeth after a meal, grabbing a coffee before work, or biting your fingernails.&lt;/p&gt;

&lt;p&gt;Habits consist of 3 elements:&lt;/p&gt;

&lt;p&gt;1) &lt;strong&gt;Cue&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, habits are triggered when there is a cue that causes a person to act on a specific behaviour. A cue is an event that triggers a routine. It can be defined by time, an emotional state, a location, or an action. For instance, when boredom strikes, you might find yourself leaving your desk to look for someone to chat with.&lt;/p&gt;

&lt;p&gt;2) &lt;strong&gt;Routine&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Second, habits are formed by daily routines or actions that satisfy reactions to certain cues. For the example I explained above, the routine (a.k.a. action) is chatting with your colleagues.&lt;/p&gt;

&lt;p&gt;3) &lt;strong&gt;Reward&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Lastly, habits are followed by internal rewards that help people feel more at ease. The reward of having a chat with colleagues is feeling awake and more energized.&lt;/p&gt;

&lt;p&gt;Here is a diagram to visually see how a habit works.&lt;/p&gt;

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

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;h3&gt;
  
  
  So, how can we change our habits into better ones?
&lt;/h3&gt;

&lt;p&gt;Cue and Reward are more about internal feelings and reactions so by changing your routine to one that gives the same reward, you can easily switch the habits you hate into habits you are proud of.&lt;/p&gt;

&lt;p&gt;For instance, instead of drinking coffee or eating snacks to stay awake, you can go for a walk or stretch your body. These will give you the same reward from the same cue and your brain will be satisfied as it is getting the same reward it expected. (Easy, aye?)&lt;/p&gt;

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

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;h3&gt;
  
  
  I get all of that. How can we apply this to make programming a habit?
&lt;/h3&gt;

&lt;p&gt;First, establish a regular cue, something you do daily, such as waking up, before lunch, or before going to bed.&lt;br&gt;
Next, create manageable routines, such as coding for 30 minutes, learning AWS for 30 minutes, or solving a Leetcode problem.&lt;br&gt;
The most crucial part of forming a habit is the reward 🏆! For instance, after coding for 30 minutes, you could make yourself breakfast or have a chocolate bar. Your brain and body will associate these rewards with the routines, encouraging their completion.&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;/p&gt;

&lt;h3&gt;
  
  
  Additional tips to make good things a habit
&lt;/h3&gt;

&lt;p&gt;1) Plan your tasks in smaller pieces&lt;/p&gt;

&lt;p&gt;If you have big tasks to complete, you will feel overwhelmed before even starting. Break them down as small as possible and cross them out as you finish them! You will feel a good sense of accomplishment.&lt;/p&gt;

&lt;p&gt;2) Prioritize your work&lt;/p&gt;

&lt;p&gt;Finish important &amp;amp; complex work in the morning, and complete creative work in the afternoon. People like Beethoven and Einstein, who have great achievements in history, tend to finish complex and time-consuming jobs in the morning and spend some time in the afternoon to recharge and do some creative jobs.&lt;/p&gt;

&lt;p&gt;3) Work on something that makes you excited and interested&lt;/p&gt;

&lt;p&gt;If things are what you truly enjoy and are interested in, it will become a habit very fast before you realise it. So find something that makes you excited and joyful.&lt;/p&gt;

&lt;p&gt; &lt;br&gt;
 &lt;br&gt;
Here's my summary of how to make programming a habit. I hope you found it helpful!&lt;/p&gt;

&lt;p&gt;Maintaining a learning mindset during tough times can be challenging, but I believe consistent effort pays off.&lt;/p&gt;

&lt;p&gt;Stay tuned for more valuable information soon.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>beginners</category>
      <category>programming</category>
      <category>productivity</category>
    </item>
    <item>
      <title>What is Event Bubbling and how we can handle this?</title>
      <dc:creator>Jaelyn Lee</dc:creator>
      <pubDate>Mon, 18 Dec 2023 20:46:25 +0000</pubDate>
      <link>https://dev.to/jaelynlee/what-is-event-bubbling-and-how-we-can-handle-this-501c</link>
      <guid>https://dev.to/jaelynlee/what-is-event-bubbling-and-how-we-can-handle-this-501c</guid>
      <description>&lt;p&gt;Hi Devs,&lt;/p&gt;

&lt;p&gt;Have you all heard about &lt;strong&gt;Event Bubbling&lt;/strong&gt;? Recently, someone asked me if I knew about this concept, and I had no idea what it was! They were also asked about it in an interview and couldn't answer. So, I decided to research and summarize the definition, as well as how we can use it in real code.&lt;/p&gt;

&lt;p&gt;Shall we start our deep dive into it?&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Event Bubbling?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Event Bubbling&lt;/strong&gt; is a concept in the DOM (Document Object Model). It occurs when an element receives an event, and that event bubbles up to its parent and ancestor elements in the DOM tree until it reaches the root element.&lt;/p&gt;

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

&lt;p&gt;As you can see from this diagram, if &lt;code&gt;button&lt;/code&gt; is clicked, all events will be propagated until it reaches the root element. Event bubbling is the default behavior for events but can be prevented in certain cases.&lt;/p&gt;

&lt;p&gt;Let me give you some examples to help you understand better.&lt;/p&gt;

&lt;p&gt;Of course, I am too lazy to write code, so I asked ChatGPT to generate it for me, and it did a great job, to be honest!&lt;/p&gt;

&lt;p&gt;So, just like the diagram above, the elements are stacked on top of each other like a set of Russian dolls.&lt;/p&gt;

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

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

&lt;p&gt;By clicking the &lt;code&gt;Inner Button&lt;/code&gt;, the logs on &lt;code&gt;innerButton&lt;/code&gt;, &lt;code&gt;middleDiv&lt;/code&gt;, and &lt;code&gt;outerDiv&lt;/code&gt; will be executed sequentially. And this is Event bubbling! A very straightforward concept, right?&lt;/p&gt;

&lt;h2&gt;
  
  
  Importance of understanding Event bubbling in Web development
&lt;/h2&gt;

&lt;p&gt;Think of event bubbling like throwing a pebble into a pond. When you toss the pebble, ripples spread outward from where it landed. Event bubbling works similarly on web pages. When something happens, like a click on a button, that "event" ripples through the different parts of a webpage, starting from where it happened and moving up to the main part of the page.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Controlling how things flow&lt;/strong&gt;: Just like you can predict where ripples go in a pond, understanding event bubbling lets developers decide how things react when you click or interact with something on a webpage.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Smart handling for many things at once&lt;/strong&gt;: Imagine if you could clap once and have everyone in a room who heard it react in a certain way. Event bubbling lets developers set up reactions for many things (like buttons) all at once without having to do it for each one individually.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Building pieces that work everywhere&lt;/strong&gt;: It's like creating LEGO pieces that fit together perfectly. With event bubbling, developers can make these parts (components) that know how to handle their own events. Then, they can use these pieces in different parts of a website without having to rebuild them each time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Making websites fun to use&lt;/strong&gt;: Event bubbling helps in creating web pages that respond when you do something, like clicking a button or dragging an item. It's what makes websites feel interactive and enjoyable to use.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In short, understanding event bubbling helps developers control how events move around a webpage, handle lots of things efficiently, make reusable parts, and create fun and interactive websites.&lt;/p&gt;

&lt;h2&gt;
  
  
  How can we handle this Event bubbling?
&lt;/h2&gt;

&lt;p&gt;What if you want to stop this from happening?&lt;/p&gt;

&lt;p&gt;There are several ways to handle Event bubbling, but I am going to explain 2 methods today.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;stopPropagation()&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The stopPropagation() method prevents further propagation of the current event. However, if an element has multiple event handlers on a single event, then even if one of them stops the bubbling, the other ones still execute. In other words, &lt;code&gt;event.stopPropagation()&lt;/code&gt; stops the upward movement, but all other handlers on the current element will still run.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;preventDefault()&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you want to stop those behaviors, you should use the &lt;code&gt;preventDefault()&lt;/code&gt; method.&lt;/p&gt;

&lt;p&gt;The &lt;code&gt;preventDefault()&lt;/code&gt; method is used to stop a specific action from happening when an event occurs. Normally, when you interact with something on a webpage (like clicking a link), the browser does something automatically (like navigating to a new page). But with &lt;code&gt;preventDefault()&lt;/code&gt;, you can tell the browser not to do that automatic action. It's like saying "Hey browser, don't do the default thing, I want to do something else instead."&lt;/p&gt;

&lt;p&gt;Just keep in mind that using &lt;code&gt;preventDefault()&lt;/code&gt; should be done carefully and only when necessary because it can change how a webpage or application behaves.&lt;/p&gt;

&lt;p&gt;Let’s have a look at a simple scenario to better understand.&lt;/p&gt;

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

&lt;p&gt;There are 3 functions to explain event handling methods.&lt;/p&gt;

&lt;p&gt;So what do you think will happen if the button is clicked?&lt;/p&gt;

&lt;p&gt;As the button is stopping the propagation from going up to the parent elements, the alert message on the outer container will not be executed.&lt;/p&gt;

&lt;p&gt;What about preventDefault()?&lt;/p&gt;

&lt;p&gt;It will prevent us from navigating to the link and will execute the remaining action.&lt;/p&gt;

&lt;p&gt;The difference between &lt;code&gt;e.preventDefault()&lt;/code&gt; and &lt;code&gt;e.stopPropagation()&lt;/code&gt; is that &lt;code&gt;e.preventDefault()&lt;/code&gt; is used to stop a specific action from happening when an event occurs, such as preventing a link from navigating to a new page. On the other hand, &lt;code&gt;e.stopPropagation()&lt;/code&gt; stops the propagation of the event to parent and ancestor elements, but other event handlers on the current element will still execute.&lt;/p&gt;

&lt;p&gt;I hope this post was helpful for your coding. Happy coding, everyone!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>discuss</category>
    </item>
    <item>
      <title>How to use React Query and How to fix minor issues from that?</title>
      <dc:creator>Jaelyn Lee</dc:creator>
      <pubDate>Mon, 07 Aug 2023 20:36:21 +0000</pubDate>
      <link>https://dev.to/jaelynlee/how-to-use-react-query-and-how-to-fix-minor-issues-from-that-3l87</link>
      <guid>https://dev.to/jaelynlee/how-to-use-react-query-and-how-to-fix-minor-issues-from-that-3l87</guid>
      <description>&lt;p&gt;Hi Devs,&lt;/p&gt;

&lt;p&gt;Today, I want to share my knowledge about an alternative way to fetch data and render it on pages using React Query. I used Redux before to manage states and fetch data but it requires too much code, which can be ridiculous. In contrast, React Query is an excellent alternative that I fell in love with immediately even though I am still learning it.&lt;/p&gt;

&lt;p&gt;Let me explain why you should use React Query and how to fix minor issues with it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why use React Query?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Caching and retrying are easier!&lt;/p&gt;

&lt;p&gt;When you use &lt;code&gt;useEffect&lt;/code&gt; to fetch data, you declare error, loading, and data using &lt;code&gt;useState.&lt;/code&gt; However, this is not reusable and makes your code too long. You may consider declaring it as a global state, but this approach seems a bit dubious and messy.&lt;/p&gt;

&lt;p&gt;React Query can resolve all these issues, including handling cache and retrying.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What is caching, by the way?&lt;/strong&gt;&lt;br&gt;
In computing, a cache is a high-speed data storage layer that stores a subset of data, typically transient in nature. This allows future requests for that data to be served up faster than accessing the data's primary storage location. Caching enables you to efficiently reuse previously retrieved or computed data.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;How can we cache data in React Query?&lt;/strong&gt;&lt;br&gt;
TanStack Query has excellent documentation that explains everything a newcomer needs to know. What a wonderful library!&lt;/p&gt;

&lt;p&gt;Check this link out if you want to deep dive into it and I highly recommend you to read.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tanstack.com/query/v4/docs/react/guides/important-defaults"&gt;https://tanstack.com/query/v4/docs/react/guides/important-defaults&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, React Query saves data as a stale status, requiring a fresh data check. However, by setting up a &lt;code&gt;staleTime&lt;/code&gt; we can define how long it will contain data as a fresh status.&lt;/p&gt;

&lt;p&gt;Let's check with actual code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight jsx"&gt;&lt;code&gt;&lt;span class="kd"&gt;const&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;isLoading&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="nx"&gt;error&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="na"&gt;data&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;products&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nf"&gt;useQuery&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="s1"&gt;products&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nx"&gt;checked&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="k"&gt;async &lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="nx"&gt;console&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;log&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;...fetching products&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
      &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nf"&gt;fetch&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;`data/&lt;/span&gt;&lt;span class="p"&gt;${&lt;/span&gt;&lt;span class="nx"&gt;checked&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;sale_&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="p"&gt;}&lt;/span&gt;&lt;span class="s2"&gt;products.json`&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;then&lt;/span&gt;&lt;span class="p"&gt;((&lt;/span&gt;&lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;=&amp;gt;&lt;/span&gt;
        &lt;span class="nx"&gt;res&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;json&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="na"&gt;staleTime&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mi"&gt;1000&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;60&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="c1"&gt;//5 mins&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;In this code sample, the staleTime is set as a third parameter when fetching data, which saves the data as defined.&lt;/p&gt;

&lt;p&gt;By installing the dev tool provided by React Query, you can check the data status and which data is updated. This makes it easy to manage bugs and debug errors, and prevents unnecessary network requests.&lt;/p&gt;

&lt;p&gt;While I have briefly covered React Query today, I plan to explore it more in-depth and cover other related topics as well.&lt;/p&gt;

&lt;p&gt;Thank you for taking the time to read this, and happy coding! 😎&lt;/p&gt;

</description>
      <category>react</category>
      <category>reactquery</category>
      <category>beginners</category>
      <category>javascript</category>
    </item>
  </channel>
</rss>
