<?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: Lior Amsalem</title>
    <description>The latest articles on Forem by Lior Amsalem (@lior_amsalem).</description>
    <link>https://forem.com/lior_amsalem</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%2F1320795%2F6c166f62-92ac-4c5d-b448-2c9ca66cb0db.jpeg</url>
      <title>Forem: Lior Amsalem</title>
      <link>https://forem.com/lior_amsalem</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/lior_amsalem"/>
    <language>en</language>
    <item>
      <title>How To Define Typescript onChange Event In React</title>
      <dc:creator>Lior Amsalem</dc:creator>
      <pubDate>Tue, 19 Mar 2024 09:04:00 +0000</pubDate>
      <link>https://forem.com/lior_amsalem/how-to-define-typescript-onchange-event-in-react-18ik</link>
      <guid>https://forem.com/lior_amsalem/how-to-define-typescript-onchange-event-in-react-18ik</guid>
      <description>&lt;p&gt;In many cases when we write JSX code, HTML inside a &lt;strong&gt;react&lt;/strong&gt; component and we’ll be using typescript. We’ll find ourself interacting with build in events of the browser. one of those events is known as “HTMLSelectElement” or the event that occurs when a user click on an element inside “option” and “Select” html tags. When user interact with those items, The browser fires event and we want to catch that event (to see what the user pick from the list of options) and perform actions accordingly.&lt;/p&gt;

&lt;p&gt;In order to make the event itself accessible via Typescript here’s What we’ll do:&lt;/p&gt;

&lt;p&gt;We’ll import changeEvent from react&lt;br&gt;
We’ll use it to assign to the change event function&lt;br&gt;
Than we’ll use “HTMLSelectElement” to define the type of the change event, which is a select HTML element.&lt;/p&gt;

&lt;p&gt;Let’s see the code&lt;br&gt;
&lt;/p&gt;

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

// Define your component
const YourComponent: React.FC = () =&amp;gt; {

  // Define the event handler function
  const handleMenuOnChange = (e: ChangeEvent&amp;lt;HTMLSelectElement&amp;gt;) =&amp;gt; { // &amp;lt;----- here we assign event to ChangeEvent
    // Your logic here
    console.log(e.target.value); // Example: Log the value of the selected option
  };

  // Render your component with the event handler attached
  return (
    &amp;lt;select onChange={handleMenuOnChange}&amp;gt;
      {/* Your select options */}
      &amp;lt;option value="1"&amp;gt;one&amp;lt;/option&amp;gt;
      &amp;lt;option value="2"&amp;gt;two&amp;lt;/option&amp;gt;
    &amp;lt;/select&amp;gt;
  );
};

export default YourComponent;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;more code examples you can find &lt;a href="https://lior.live/software-engineering/how-to-define-typescript-onchange-event-in-react/"&gt;here&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>hooks</category>
      <category>javascript</category>
      <category>typescript</category>
    </item>
    <item>
      <title>How To Fix Samsung SSD Not Detected Mac book</title>
      <dc:creator>Lior Amsalem</dc:creator>
      <pubDate>Wed, 13 Mar 2024 09:46:55 +0000</pubDate>
      <link>https://forem.com/lior_amsalem/how-to-fix-samsung-ssd-not-detected-mac-book-4n8j</link>
      <guid>https://forem.com/lior_amsalem/how-to-fix-samsung-ssd-not-detected-mac-book-4n8j</guid>
      <description>&lt;p&gt;In case you’ve got yourself the new samsung SSD T7, T9 etc like myself. you might encounter a problem during the initial setup. in the empty SSD you’ll find a setup file for macbook called “SamsungPortableSSD_Setup_Mac_1.0.pkg” that is used to install “samsung portable SSD” application for samsung SSD external device.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;T9 Not Detected&lt;/strong&gt;&lt;br&gt;
Even if you connect/disconnect the usb cable you might encounter the samsung portable ssd problem . even if you try to restart your mac or re-install the software samsung portable ssd the error will remain.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Solution&lt;/strong&gt;&lt;br&gt;
Simply follow the next steps to fix the problem and continue setup of T7, T9 ssd external drives.&lt;br&gt;
&lt;a href="https://lior.live/general/how-to-fix-samsung-ssd-not-detected-mac-book/"&gt;Read More&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Fine-grained Reactivity – Front end Rendering Champion</title>
      <dc:creator>Lior Amsalem</dc:creator>
      <pubDate>Sun, 03 Mar 2024 06:10:09 +0000</pubDate>
      <link>https://forem.com/lior_amsalem/fine-grained-reactivity-front-end-rendering-champion-1e9g</link>
      <guid>https://forem.com/lior_amsalem/fine-grained-reactivity-front-end-rendering-champion-1e9g</guid>
      <description>&lt;p&gt;Fine-grained reactivity refers to a programming paradigm or approach where updates to the user interface (UI) are handled at a very granular level, typically down to individual data changes. In the context of frontend development, this concept is often associated with libraries or frameworks that prioritize performance and efficiency by minimizing unnecessary re-renders of components.&lt;/p&gt;

&lt;p&gt;In traditional virtual DOM-based frameworks like React, when the state of a component changes, the entire component is typically re-rendered. This approach can be inefficient, especially in large applications with complex UIs, as it can lead to unnecessary re-renders of components that are not affected by the state change.&lt;/p&gt;

&lt;p&gt;Fine-grained reactivity addresses this issue by intelligently tracking dependencies between data and UI elements, ensuring that only the parts of the UI that are directly affected by state changes are updated. This means that if a specific piece of data changes, only the corresponding UI elements that depend on that data will be re-rendered, while other unaffected parts of the UI remain unchanged.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://lior.live/software-engineering/fine-grained-reactivity-front-end-rendering-champion/"&gt;continue to read&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
