I have come across discussions of how to get a parent class component to call a child class component and a few instances of other mixes but have yet to find a working example of calling a function in a class child component from a functional parent component. Code for instance:
function ParentForm(props) {
const parentDoSomething = () => {
// Want to call child component function childDoSomething() somewhere in here.
}
...
return (
... various visual elements, buttons, etc. ...
<ChildComponent />
...
);
// ----------------------------------
class ChildComponent extends React.Component {
...
childDoSomething = () => {
... does something ...
}
You'd think there'd be an easy straightforward way to do this but it is eluding me. Can anyone give me good working examples of this solution? Thanks in advance as always.