Closed mcallistertyler closed 2 years ago
Hello @mcallistertyler! There are 2 ways to do it:
cell
and have the list of headers outside of the component (so it is always static): https://codesandbox.io/s/3-0-1-buttons-in-table-example-fir1fw?file=/src/App.js{
prop: "button",
cell: (row) => (
<button onClick={() => {
alert(`${row.username}'s score is ${row.score}`)
}}>Click me</button>
)
}
{
prop: "button",
cell: (row) => (
<button
onClick={() => {
alert(
`${row.username}'s score is ${row.score} and you have clicked the button ${counter} times.`
);
setCounter((oldState) => oldState + 1);
}}
>
Click me
</button>
)
}
Let me know if there are parts that I can explain more!
Exactly what I was looking for, thanks for these examples - very helpful and clear 👍
Hi, is there a way to add a column of buttons within the table? Similar to the example with the checkboxes.
Thanks