0

I've run into an interesting scenario where I need to let the Child2's method be called by Child1.

export class Parent extends React.Component{ 

child2: Child2; // has a reloadChild2 method

...  

<Child1 reloadSibling={this.child2.reloadChild2}>
...

}

I'm trying to create an instance of Child2 and pass its method as a prop to Child1. I'm not sure if this is the way to go about.

John
  • 693
  • 1
  • 12
  • 37

1 Answers1

0

These questions and answers helped me to understand the various options we have:

ReactJS Two components communicating

React – the right way to pass form element state to sibling/parent elements?

John
  • 693
  • 1
  • 12
  • 37