title: How call function without event handlers in React
body: <p>I want to change state elements if condition is met. To make this I tried wrote a function where I have this condition and my new state when condition is met. But how can I call this function? I dont need event handlers like onClick or onChange. But how can it be otherwise?</p>
  <pre><code>this.state = {
      isPresidentVisible: false,
      result: 0,
      minutes: 3,
      seconds: 0,
      isQuizRunning: false,
      isInputDisabled: true,
      isGiveUpVisible: false,
    }
  }
  
    handleChange = (e) =&gt; {
      const index = presidents.findIndex(president =&gt; (
        president.lastName.toLowerCase() === e.target.value.toLowerCase() || `${president.name.toLowerCase()} ${president.lastName.toLowerCase()}` === e.target.value.toLowerCase()));
      
      if(index !== -1){
        presidents[index].isPresidentVisible = true;
        const isPresidentVisible = presidents[index].isPresidentVisible;
        this.setState(({result}) =&gt; ({
          isPresidentVisible,
          result: result + 1
        }))
        e.target.value = '';
      }
    }
  
  
    handleClick = () =&gt; {
      
      this.setState({
        isQuizRunning: true,
        isInputDisabled: false,
        isGiveUpVisible: true
      })
      this.interval = setInterval(() =&gt; {
        const {seconds, minutes} = this.state
        if(seconds &gt; 0){
        this.setState(({seconds}) =&gt; ({
          seconds: seconds - 1
        }))
        }
        if(seconds === 0){
          if(minutes === 0){
            this.handleEndGame();
          } else{
            this.setState(({minutes}) =&gt; ({
              minutes: minutes - 1,
              seconds: 59
            }))
          }
        }
      },1000)
    }
  
    handleEndGame = () =&gt; {
      clearInterval(this.interval)
      const isPresidentVisible = presidents.map(president =&gt; (president.isPresidentVisible = true))
        this.setState({
          isPresidentVisible,
          isInputDisabled: true,
          isGiveUpVisible: false,
      })
    }
  </code></pre>
  <p>I want to make condition:</p>
  <pre><code>   checkCondition = () =&gt; {
      const {result} = this.state;
      if(result === presidents.length){
        this.handleEndGame();
      }
    }
  </code></pre>