title: React-Native = Invariant Violation: Maximum update depth exceeded
body: <p>I have this error, and i didn't have it before :
  <a href="https://i.stack.imgur.com/8Ozga.png" rel="noreferrer">here is the image of the error</a>
  Invariant Violation: Maximum update depth exceeded. This can happen when a component repeatedly calls setState inside componentWillUpdate or componentDidUpdate. React limits the number of nested updates to prevent infinite loops.</p>
  
  <p>This error is located at:
  in Connect (at LoginForm.js:75)</p>
  
  <pre><code>render() {
  const { inputStyle, containerStylePass, containerStyleIdent, barStyle, textInputStyle } = styles;
  
  return (
     &lt;View&gt;
      &lt;View&gt;{/* all the password form*/}
        &lt;View style={containerStylePass}&gt;
        icon
          &lt;Text style={inputStyle}&gt;Mot de passe&lt;/Text&gt;
        &lt;/View&gt;
        &lt;TextInput
          secureTextEntry
          autoCorrect={false}
          style={textInputStyle}
        /&gt;
        &lt;View style={barStyle} /&gt;
      &lt;/View&gt;
  
      &lt;View&gt;
        &lt;Connect /&gt;
      &lt;/View&gt;
    &lt;/View&gt;
  </code></pre>
  
  <p>I don't know why is  an error, can anyone help?</p>
  
  <p>here is my  code :</p>
  
  <pre><code>import React, { Component } from 'react';
  import { Text, TouchableOpacity } from 'react-native';
  import LinearGradient from 'react-native-linear-gradient';
  
  class Connect extends Component {
  
    render() {
      return (
        &lt;TouchableOpacity onPress={this.setState({ butPressed: true })}&gt;
          &lt;LinearGradient
            colors={['#56EDFF', '#42F4A0']}
            start={{ x: 0.0, y: 1.0 }} end={{ x: 1.0, y: 1.0 }}
          &gt;
            &lt;Text style={textStyle}&gt;
              Se connecter
            &lt;/Text&gt;;
          &lt;/LinearGradient&gt;
        &lt;/TouchableOpacity&gt;
      );
    }
  }
  </code></pre>