Passing array from child to parent component
To pass the assigned_users
array from a child component to its parent component, you need to follow these steps:
Create a callback function in the parent component: This function will be responsible for receiving the
assigned_users
array.Pass the callback function to the child component as a prop: The child component can then call this function when it wants to send the
assigned_users
array to the parent.Call the callback function from the child component: Inside the child component, when you want to send the data to the parent (e.g., after updating
assigned_users
), you call the callback function with the updated array.
Parent Component
Child Component
Comments
Post a Comment
What is your thought about this?