title: How to re-render/update the table in react js after CRUD operations?
body: <p>I've used simple table (code appended below) and tried looking out for many references but couldn't find an appropriate solution to my problem. The table is displayed fine, but the problem starts when any data is added, updated or deleted. It doesn't get reflected unless the page is refreshed. Few ways that I've tried is updating state but doesn't help. I even tried updating the component forcefully but in vain. I even tried rendering the component.</p>
  
  <pre><code>&lt;div className="table"&gt;
    &lt;table className="table table-striped table-padding"&gt;
      &lt;thead&gt;
        &lt;tr className="heading"&gt;
          &lt;th className="col-md-2"&gt;Image&lt;/th&gt;
          &lt;th className="col-md-3"&gt;Office Name&lt;/th&gt;
          &lt;th className="col-md-5"&gt;Address&lt;/th&gt;
          &lt;th className="col-md-1"&gt;&lt;/th&gt;
          &lt;th className="col-md-1"&gt;&lt;/th&gt;
        &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody&gt;
        {
          (this.state.dataUpdated) &amp;&amp;
            this.state.data.map((list, index) =&gt; {
              return (
                &lt;tr key={index}&gt;
                  &lt;td&gt;&lt;img style={{height: '30px', width: '30px'}} src={list.imageData} alt="icon"/&gt;&lt;/td&gt;
                  &lt;td&gt;{list.name}&lt;/td&gt;
                  &lt;td&gt;{list.address}&lt;/td&gt;
                  &lt;td&gt;&lt;button type="button" onClick={(e) =&gt; this.handleEdit(list.officeId)}&gt;&lt;i className="fa fa-pencil" aria-hidden="true"&gt;&lt;/i&gt;&lt;/button&gt;&lt;/td&gt;
                  &lt;td&gt;&lt;button type="button" onClick={(e) =&gt; this.handleDelete(list.officeId)}&gt;&lt;i className="fa fa-trash" aria-hidden="true"&gt;&lt;/i&gt;&lt;/button&gt;&lt;/td&gt;
                &lt;/tr&gt;
              )
  
            })
          }
        &lt;/tbody&gt;
     &lt;/table&gt;
  &lt;/div&gt;
  
  handleEdit(id) {
    this.state.data.map(row =&gt; {
      if(row.officeId === id) {
        return (
          this.setState({ displayData: row })
        )
      }
    });
    this.displayOfficeList();
  }
  
  handleDelete(id) {
    const { dispatch } = this.props;
    dispatch(commonActions.deleteOffice(id));
    this.displayOfficeList();
  }
  
  displayOfficeList() {
    this.toggleFlag();
    commonServices.getOfficeList().then((res) =&gt; {
      let demo = res;
      this.setState({ data: demo.content});
      this.setState({ dataUpdated: true});
    });
  }
  </code></pre>