title: Reactjs - I am trying to handle and event in a popup, but the popup is not being rendered as it should after an event execution
body: <p>I have a function that is called when the user clicks a button on a popup of a reactjs applicatiomn. </p>
  
  <pre><code>sendAnswer = () =&gt; {
  
        event.preventDefault();
        console.log(this.answer);
        const data = { answer: this.answer };
        const requestInfo = {
            method: 'POST',
            body: JSON.stringify(data),
            headers: new Headers({
                'Content-Type': 'application/json'
            }),
        };
  
        fetch('http://www.mocky.io/v2/5d920649310000d48110ccd7', requestInfo)
        .then(response =&gt; {
            if(response.ok) {
              console.log('ok')
              this.setState({sentAnswer: true})
  
                return response.json()
            }
            throw new Error("Erro ao enviar a resposta...");
        })
        .catch(e =&gt; {
            this.setState({ message: e.message });
        });
      }
  </code></pre>
  
  <p>I have this code here in render():</p>
  
  <pre><code>{!this.state.sent ? (
              &lt;textarea type="text" id="form10" className="md-textarea form-control" rows="3" onChange={e =&gt; this.answer = e.target.value} placeholder="Insira a sua resposta aqui" /&gt;
                                  ) : ( 
              &lt;Alert color="primary" className="text-center"&gt; Message was sent! &lt;/Alert&gt;
                                  )}  
  </code></pre>
  
  <p>However, the popup is not refreshed. The sendAswer function is being called and executed, but I need to refresh the popup and show the message "Message was sent!" after its execution.</p>
  
  <p>How can I make it? </p>