score:0

componentDidMount(prevProps, prevState) { 
    if (this.updateTimer) { return; }  

    this.updateTimer = setInterval(() => {
      fetch('/api/ReponseCommentaire/listerReponseCommentaire', {
        method: "GET",
        headers: {
          'Accept': 'application/json, application/xml, text/plain, text/html, *.*',
          'Content-Type': 'application/json'
        }
      })
      .then(response => response.json())
      .then(response => {
        this.setState({
          ...this.state,
          reponseCommentaires: response,
        });
      })
      .catch((err) => console.log('fetch failed => ', err) )

    }, 1000);
}

Related Query

More Query from same tag