Using React [15.6.1] Redux [3.7.2] and Router [4.1.1] I'm tryin to access a method that belongs to other (siblings) components but can't seem to be able to access them. Is there anyway to export those methods?
----------
¦ Parent ¦
----------
¦
-------------------------------
¦ ¦ ¦
----------- ----------- -----------
¦ Child 1 ¦ ¦ Child 2 ¦ ¦ Child 3 ¦
----------- ----------- -----------
// Child 1 has a method submitChild1()
// Child 2 has a method submitChild2()
// Child 3 has to access both of those methods
class Parent1 extends React.Component {
render() {
return (
<div>
<Child1 />
<Child2 />
<Child3 />
</div>
);
}
}
class Child1 extends React.Component {
submitChild1() {
dispatch(Action1());
}
render() {...}
}
class Child2 extends React.Component {
submitChild2() {
dispatch(Action2());
}
render() {...}
}
class Child3 extends React.Component {
submitTheOtherMethods() {
// try to access Child 1 method
// try to access Child 2 method
}
render() {...}
}