react-table v7 how to inject attributes into the table tag

57 views Asked by At

All the examples I have seen look like the following:

<table {...getTableProps()}>
    <thead>
        ...
    </thead>

    <tbody {...getTableBodyProps()}>
        ...
    </tbody>
</table>

The documentation tells us getTableProps() by default returns {role:"table"}, thus my table renders as:

<table role="table">

What I'd like to do is render, for example:

<table role="table" hello="world" prop2="value2">

, therefore i'd have to inject the props {role:"table", hello:"world", prop2:"value2} somewhere.

I have no idea how/where to modify getTableProps() to achieve this;

0

There are 0 answers