Skip to content
Advertisement

Delete a row from a table using and Id React

I have this table which is created using data from my back end

JavaScript

And its columns are made with this function

JavaScript

I added a button which calls the deleteStudent function and sends it to my Backend

JavaScript

but I don’t know how to pass the studentId for the specific row

this is my initial state

JavaScript

Advertisement

Answer

Just use second params to get the studentId like this. This is the same when you render avatar. You can read more props in docs: https://ant.design/components/table/#Column

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement