Skip to content
Advertisement

How to send table values to another component which will be visible later in React?

I have a table and edit/delete button on that table(each row) to edit/delete corresponding row.

I want to open a popup when the edit is clicked but I want to open the popup with some parameters to show like “old value, new value” etc.

Here is my code for table and I put an EditUserPopup component at bottom.

JavaScript

I am calling editCustomer() function by the button on table and I am thinking to make EditPopup somehow visible with some param, and in other component(popup’s itself) I’ll do some logic.

But I cannot reach the id,firstName,lastName values in popup. How can I send corresponding table row values to the popup ?

The page is this: enter image description here

Advertisement

Answer

You can create a react state and set them inside the edit function. Then you should send them as props to your pop up.

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