<?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>Forem: Note to myself</title>
    <description>The latest articles on Forem by Note to myself (@notetomyself).</description>
    <link>https://forem.com/notetomyself</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%2F648030%2F2c0dc8eb-3966-42ed-acba-a05fb4eebee7.png</url>
      <title>Forem: Note to myself</title>
      <link>https://forem.com/notetomyself</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/notetomyself"/>
    <language>en</language>
    <item>
      <title>Prevent onClick event on clicking child component</title>
      <dc:creator>Note to myself</dc:creator>
      <pubDate>Sun, 03 Jul 2022 18:43:14 +0000</pubDate>
      <link>https://forem.com/notetomyself/prevent-onclick-event-on-clicking-child-component-4o3j</link>
      <guid>https://forem.com/notetomyself/prevent-onclick-event-on-clicking-child-component-4o3j</guid>
      <description>&lt;p&gt;On situations when you want to trigger an onClick event when you click on a box but you have an input inside of it. In this case you will trigger the onClick event whenever you are willing to type in any input. &lt;br&gt;
To prevent this write a function to stop propagation and add it to the child(input).&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  function handleClicked {
    // Do something.
  }
  function stopPropagation(e) {
    e.stopPropagation();
  }

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;div onClick={handleClicked}&amp;gt;
        &amp;lt;input onClick={stopPropagation} /&amp;gt;
      &amp;lt;/div&amp;gt;
    &amp;lt;/div&amp;gt;
  );
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>react</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>beginners</category>
    </item>
    <item>
      <title>React 18: useTransition</title>
      <dc:creator>Note to myself</dc:creator>
      <pubDate>Mon, 30 May 2022 08:04:09 +0000</pubDate>
      <link>https://forem.com/notetomyself/react-18-usetransition-2k2g</link>
      <guid>https://forem.com/notetomyself/react-18-usetransition-2k2g</guid>
      <description>&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Can boost performance by delaying high cost actions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Added in React 18&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;example)&lt;br&gt;
&lt;/p&gt;

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

function App () {
  const [value, setValue] = useState("");
  const [isPending, startTransition] = useTransition();

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;input
        onChange={(e) =&amp;gt; {
          startTransition(() =&amp;gt; {
            setValue(e.target.value);
          });
        }}
      /&amp;gt;
      {isLoading ? "Loading..." : "Loaded"}
    &amp;lt;/div&amp;gt;
  );
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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