title: Re-rendering Table component when parent passes new or updated data
body: <p>I am transitioning from React Table 6 to 7, which comes with a lot of new changes as React Table 7 is now a headless utility library, built with lots and lots of hooks. This is much different from React Table 6. I am not too familiar with hooks, and haven't used them previously (I had read up on them a few months back), but am now sort of forced to get into the weeds of them, as my application relies heavily on this library.</p>
  <p>Using <a href="https://react-table.js.org/examples/simple" rel="nofollow noreferrer">the examples guide here</a>, I am setting up an initial table in my react app, attempting to connect the table to the live data for my app which is fetched with Axios. However, I am struggling right out of the gate with an initial important functionality - having the Table component show / update the data that I am passing to it, <em>but only after that data changes</em>.</p>
  <p>To help make clearer, I have created the following component:</p>
  <pre><code>import React from 'react';
  import { useTable } from 'react-table';
  
  function MyReactTable7Table({ tableData }) {
  
      // 1. Create Columns
      const columns = React.useMemo(
          () =&gt; [
              {
                  Header: 'Name',
                  columns: [
                      {
                          Header: 'Col Available From Start',
                          accessor: 'conferenceId'
                      },
                      {
                          Header: 'Col Avail After Parent Re-Render',
                          accessor: 'teamMarket'
                      }
                  ]
              }
          ],
          []
      );
  
      // 2. Create Data
      const data = React.useMemo(() =&gt; tableData, []);
  
      // 3. Call Use Table
      const {
          getTableProps,
          getTableBodyProps,
          headerGroups,
          rows,
          prepareRow
      } = useTable({ columns, data });
  
      // 4. Return the HTML Table
      return (&lt;&gt;
          &lt;table {...getTableProps()}&gt;
              &lt;thead&gt;
                  {headerGroups.map(headerGroup =&gt; (
                      &lt;tr {...headerGroup.getHeaderGroupProps()}&gt;
                          {headerGroup.headers.map(column =&gt; (
                              // Add the sorting props to control sorting. For this example
                              // we can add them into the header props
                              &lt;th {...column.getHeaderProps()}&gt;
                                  {column.render('Header')}
                              &lt;/th&gt;
                          ))}
                      &lt;/tr&gt;
                  ))}
              &lt;/thead&gt;
              &lt;tbody {...getTableBodyProps()}&gt;
                  {rows.map(
                      (row) =&gt; {
                          prepareRow(row);
                          return (
                              &lt;tr {...row.getRowProps()}&gt;
                                  {row.cells.map(cell =&gt; {
                                      return (
                                          &lt;td {...cell.getCellProps()}&gt;{cell.render('Cell')}&lt;/td&gt;
                                      );
                                  })}
                              &lt;/tr&gt;
                          );
                      }
                  )}
              &lt;/tbody&gt;
          &lt;/table&gt;
      &lt;/&gt;);
  }
  
  export default MyReactTable7Table;
  </code></pre>
  <p>This is pretty much copied directly from the example page, except rather than using mock data, I am passing the data that is fetched from the parent component and passed as a prop. Here's the problem though: although the data from the parent component does update (initially, a skinny table with only 5 columns is fetched, and then a larger table with 20 columns is fetched that replaces the first table in the parent components state), the UI doesn't update on my web app. (I think because the table component's internal state is not updating?)</p>
  <p>Im my example, <code>conferenceId</code> is 1 of the initial 5 columns fetched, however <code>teamMarket</code> is one of the 20 but not one of the 5 initial columns. Although the parent component fetches the new data and rerenders, the Table Component does not update to show the new data in the new column.</p>
  <p>I am figuring out hooks and headless components on the fly with this, and would like to follow best practices with using this library, because from the docs + examples, it seems like a very good and powerful table component for React.</p>
  <h2>Edit</h2>
  <p>To update and clarify quickly, maybe it is a bad pattern for the parent component to fire off 2 separate async Axios fetches to update the same parent state variable. I'm not sure. As I mentioned, and just to clarify, the 1st fetch quickly grabs a skinny version of the data, while the 2nd fetch grabs the full table. Because the parent state updates with the new data array, the array being passed as the <code>tableData</code> prop to <code>&lt;MyReactTable7Table /&gt;</code> changes as well.</p>
  <p>It's tough to hook up live, because the bug / issue itself is related to the live data not updating correctly...</p>