<?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: Lalit LP</title>
    <description>The latest articles on DEV Community by Lalit LP (@lalitpatil1634).</description>
    <link>https://dev.to/lalitpatil1634</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%2F1116888%2Fb6c99340-b6ac-4641-9f9c-c4ccb3c8d339.jpeg</url>
      <title>DEV Community: Lalit LP</title>
      <link>https://dev.to/lalitpatil1634</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lalitpatil1634"/>
    <language>en</language>
    <item>
      <title>React Counter App...</title>
      <dc:creator>Lalit LP</dc:creator>
      <pubDate>Mon, 10 Jul 2023 13:27:58 +0000</pubDate>
      <link>https://dev.to/lalitpatil1634/react-counter-app-2om7</link>
      <guid>https://dev.to/lalitpatil1634/react-counter-app-2om7</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import React, { useState } from 'react';

function Counter() {
  const [count, setCount] = useState(0);

  const handleIncrement = () =&amp;gt; {
    setCount(count + 1);
  };

  const handleDecrement = () =&amp;gt; {
    setCount(count - 1);
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h2&amp;gt;Count: {count}&amp;lt;/h2&amp;gt;
      &amp;lt;button onClick={handleIncrement} data-testid="plus-btn"&amp;gt;+&amp;lt;/button&amp;gt;
      &amp;lt;button onClick={handleDecrement} data-testid="minus-btn"&amp;gt;-&amp;lt;/button&amp;gt;
    &amp;lt;/div&amp;gt;
  );
}

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

&lt;/div&gt;



&lt;p&gt;In this solution, I've used the useState hook to declare a state variable for the current count. I've also defined two event handlers, handleIncrement and handleDecrement, that update the count using the setCount function.&lt;/p&gt;

&lt;p&gt;In the return statement, I'm displaying the current count along with two buttons that call the event handlers when clicked. I've also added &lt;strong&gt;data-testid&lt;/strong&gt; attributes to each button so that they can be tested using React Testing Library or a similar tool.&lt;/p&gt;

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