title: "To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function." error But I'm not using it
body: <blockquote>
  <p>Warning: Can't perform a React state update on an unmounted component.
  This is a no-op, but it indicates a memory leak in your application.
  To fix, cancel all subscriptions and asynchronous tasks in a useEffect
  cleanup function.</p>
  </blockquote>
  <p>I have tried everything to fix but nothing works. I didn't even use &quot;useEffect&quot;. This happens when I login to account and navigate the user to search page.</p>
  <blockquote>
  <p>loginScreen.js</p>
  </blockquote>
  <pre><code>const validationSchema = Yup.object().shape({
    email: Yup.string()
      .label(&quot;Email&quot;)
      .email(&quot;Enter a valid email&quot;)
      .required(&quot;Please enter a registered email&quot;),
    password: Yup.string()
      .label(&quot;Password&quot;)
      .required()
      .min(6, &quot;Password must have at least 6 characters &quot;),
  });
  const { width, height } = Dimensions.get(&quot;window&quot;);
  class loginScreen extends React.Component {
    state = {
      passwordVisibility: true,
      rightIcon: &quot;ios-eye&quot;,
    };
  
    goToSignup = () =&gt; this.props.navigation.navigate(&quot;Signup&quot;);
  
    handlePasswordVisibility = () =&gt; {
      this.setState((prevState) =&gt; ({
        rightIcon: prevState.rightIcon === &quot;ios-eye&quot; ? &quot;ios-eye-off&quot; : &quot;ios-eye&quot;,
        passwordVisibility: !prevState.passwordVisibility,
      }));
    };
    handleOnLogin = async (values, actions) =&gt; {
      const { email, password } = values;
      try {
        const response = await this.props.firebase.loginWithEmail(
          email,
          password
        );
  
        if (response.user) {
          this.props.navigation.navigate(&quot;App&quot;);
        }
      } catch (error) {
        alert(&quot;Seems like there is no account like that. Try something else.&quot;);
      } finally {
        actions.setSubmitting(false);
      }
    };
  </code></pre>
  <blockquote>
  <p>searchScreen.js</p>
  </blockquote>
  <pre><code>class searchScreen extends Component {
    apiurl = &quot;&quot;;
    _isMounted = false;
    constructor(props) {
      super(props);
      this.state = {
        searchText: &quot;&quot;,
        results: [],
        isLoading: true,
      };
    }
  
    showMovie = async (imdbID) =&gt; {
      await axios(this.apiurl + &quot;&amp;i=&quot; + imdbID).then(({ data }) =&gt; {
        let result = data;
        this.props.navigation.navigate(&quot;Movie&quot;, {
          selected: result,
          movieID: imdbID,
        });
      });
    };
    componentDidMount() {
      this._isMounted = true;
      this.initial();
    }
    componentWillUnmount() {
      this._isMounted = false;
    }
  
    initial = async () =&gt; {
      const user = await this.props.firebase.getUser(user);
  
      try {
        await AsyncStorage.setItem(&quot;useruid&quot;, user.uid);
      } catch (error) {
        console.log(error);
      }
      const expoToken = await UserPermissions.registerForPushNotificationsAsync();
      if (expoToken) {
        this.props.firebase.setExpoToken(expoToken);
      }
      if (this._isMounted) {
        this.setState({ isLoading: false });
      }
    };
    search = async () =&gt; {
      Keyboard.dismiss();
      await axios(this.apiurl + &quot;&amp;s=&quot; + this.state.searchText).then(
        ({ data }) =&gt; {
          let results = data.Search;
          if (this._isMounted) {
            this.setState((prevState) =&gt; {
              return { ...prevState, results: results };
            });
          }
        }
      );
    };
  </code></pre>