<?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: meriam-hamdaoui</title>
    <description>The latest articles on DEV Community by meriam-hamdaoui (@meriamhamdaoui).</description>
    <link>https://dev.to/meriamhamdaoui</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F806865%2F4ac5bfd1-076e-4fbf-8961-9a2e27689bd4.jpeg</url>
      <title>DEV Community: meriam-hamdaoui</title>
      <link>https://dev.to/meriamhamdaoui</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/meriamhamdaoui"/>
    <language>en</language>
    <item>
      <title>button event dispatch action on second click</title>
      <dc:creator>meriam-hamdaoui</dc:creator>
      <pubDate>Sun, 13 Nov 2022 15:02:43 +0000</pubDate>
      <link>https://dev.to/meriamhamdaoui/button-event-dispatch-action-on-second-click-l7l</link>
      <guid>https://dev.to/meriamhamdaoui/button-event-dispatch-action-on-second-click-l7l</guid>
      <description>&lt;p&gt;i'm trying to build a fake authentication react app with redux toolkits.&lt;/p&gt;

&lt;p&gt;the problem is the button works only on second click.&lt;br&gt;
the first click only checks the validation form, i had to click second one to pass to the action and change the redux state&lt;/p&gt;

&lt;p&gt;this is my create account function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt; const createAccount = (event) =&amp;gt; {
    const form = event.currentTarget;
    if (form.checkValidity() === false) {
      event.preventDefault();
      event.stopPropagation();
    }

    setValidated(true);

    const findUser = userList.find((user) =&amp;gt; user.email === email);
    // console.log(typeof findUser);
    if (validated) {
      if (findUser) {
        alert("this user already exist, login?");
      } else {
        dispatch(signup(newAccount));
      }
      navigate("/signin", { replace: true });
    }
  };
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



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