react-bootstrap-table / react-bootstrap-table2

Next Generation of react-bootstrap-table
https://react-bootstrap-table.github.io/react-bootstrap-table2/
MIT License
1.27k stars 431 forks source link

How to add hook functionality in a custom cell button #1721

Open ignaraph opened 2 years ago

ignaraph commented 2 years ago

Question Hello, i have recently created a table that has a custom cell in the last column, the cell contains a button. This button should trigger the opening of a Modal so that the user can decide to delete that row. I want to use React-Bootstrap Modal component but it uses state to handle the opening or closing of the Modal. The problem is that when I tried to use a hook like useState in the custom cell component, react crashes because of breaking hook rules i believe. Is there a way to do this??

Screenshots

image image

Thank you in advance for your help

26z1a commented 2 years ago

for create a button in custom columns that open a modal, u can have a look at this codesandbox

and as im still learning react|react-bootstrap-table2, maybe i couldn't resolve all ur problems but im still try my best

ignaraph commented 2 years ago

Thank you very much for your help, I will try this approach :)