<?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: Federico Matias Bais</title>
    <description>The latest articles on DEV Community by Federico Matias Bais (@fedebais).</description>
    <link>https://dev.to/fedebais</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%2F193897%2F206718c0-2245-439e-a825-ab824ca76572.jpg</url>
      <title>DEV Community: Federico Matias Bais</title>
      <link>https://dev.to/fedebais</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fedebais"/>
    <language>en</language>
    <item>
      <title>condition inside map array - React Native</title>
      <dc:creator>Federico Matias Bais</dc:creator>
      <pubDate>Thu, 11 Jul 2019 17:42:06 +0000</pubDate>
      <link>https://dev.to/fedebais/condition-inside-map-array-react-native-41d5</link>
      <guid>https://dev.to/fedebais/condition-inside-map-array-react-native-41d5</guid>
      <description>&lt;p&gt;Hi i want to login with a local data array but i cant get an error alert when the username and password is worng. please can you guide me? &lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;constructor (props) {
    super(props);
    this.state = {

        username: '',
        password: '',
        login:2,

    };
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;onButtonPress = () =&amp;gt; {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;          data.map((dataItem) =&amp;gt;{
            if(dataItem.user == this.state.username &amp;amp;&amp;amp; dataItem.pass == this.state.password  ){
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;this.setState({   login: 1 }, () =&amp;gt; {&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    Alert.alert("Welcome");
    this.props.navigation.navigate("Home");



});
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

&lt;p&gt;}&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;         }  )


         if (this.state.login = 2) {
             Alert.alert("Error");

         }



          }
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

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