title: React-Table: Get selectedRowIds in parent component
body: <p>I'm rendering a react-table and need to know which rows are selected in the parent component.</p>
  <p><strong>Here is my table component:</strong></p>
  <pre><code>const TableComponent = (props) =&gt; {
    const { columns, data } = props;
    const {
      getTableProps,
      getTableBodyProps,
      headerGroups,
      rows,
      prepareRow,
      state: { selectedRowIds },
    } = useTable(
      {
        columns,
        data,
      },
      useRowSelect
    );
  
    return (
      &lt;table {...getTableProps()}&gt;
          &lt;thead&gt;
              {headerGroups.map((headerGroup) =&gt; (
              &lt;tr {...headerGroup.getHeaderGroupProps()}&gt;
                  {headerGroup.headers.map((column) =&gt; (
                  &lt;th {...column.getHeaderProps()}&gt;{column.render(&quot;Header&quot;)}&lt;/th&gt;
                  ))}
              &lt;/tr&gt;
              ))}
          &lt;/thead&gt;
          &lt;tbody {...getTableBodyProps()}&gt;
              {rows.slice(0, 10).map((row, i) =&gt; {
              prepareRow(row);
              return (
                  &lt;tr {...row.getRowProps()}&gt;
                  {row.cells.map((cell) =&gt; {
                      return (
                      &lt;td {...cell.getCellProps()}&gt;{cell.render(&quot;Cell&quot;)}&lt;/td&gt;
                      );
                  })}
                  &lt;/tr&gt;
              );
              })}
          &lt;/tbody&gt;
      &lt;/table&gt;
    );
  };
  </code></pre>
  <p><strong>And here is the parent:</strong></p>
  <pre><code>function App() {
    const columns = React.useMemo(
      () =&gt; [
        {
          Header: &quot;Name&quot;,
          columns: [
            {
              Header: &quot;First Name&quot;,
              accessor: &quot;firstName&quot;,
            },
            {
              Header: &quot;Last Name&quot;,
              accessor: &quot;lastName&quot;,
            },
          ],
        },
        {
          Header: &quot;Info&quot;,
          columns: [
            {
              Header: &quot;Age&quot;,
              accessor: &quot;age&quot;,
            },
            {
              Header: &quot;Visits&quot;,
              accessor: &quot;visits&quot;,
            },
            {
              Header: &quot;Status&quot;,
              accessor: &quot;status&quot;,
            },
            {
              Header: &quot;Profile Progress&quot;,
              accessor: &quot;progress&quot;,
            },
          ],
        },
      ],
      []
    );
  
    const data = React.useMemo(() =&gt; makeData(10, 3), []);
  
    return (
      &lt;Table columns={columns} data={data} /&gt;
    );
  }
  </code></pre>
  <p>I need to know the <code>selectedRowIds</code> in the parent component. Does anyone know how I'd get those from the child?</p>