Reputation: 79
I used a component as a child as follows, and in the parent component, ie ShowBodyQuestionsForArchive component, I used the child component as follows: {children}
in ShowBodyQuestionsForArchive component(parent) i have another componet As follows:
I want to change the data of ShowImage component in ShowComparetiveItemsForArchive component(child), which is displayed as {children}
Upvotes: 0
Views: 529
Reputation: 158
const ShowComparativeQuestionForArchive = ({question, number, items}) => {
changeShowImage(){
//changedData
}
return(
<ShowBodyQuestionForArchive question = {question} number = {number}>
<ShowComparativeItemsForArchive changeShowImage = {changeShowImage()} number = {number} items = {items} />
{
showImage ? <ShowImage {changedData} /> //example
}
<ShowBodyQuestionForArchive/>
)
}
Now call the prop (changeShowImage) in ShowComparativeItemsForArchive
Upvotes: 0