In react, how the parent component invokes the method of the child component, or is it possible to set the state of the child component (without redux)

if you want to ask everyone, in react, the parent component has a way to call the method of the child component, or set the state of the child component. Thank you!

Feb.28,2021

of course = We need to use props to pass-the root of redux is that there are too many state controls and it is not easy to manage, so we use redux. And in general, redux is not recommended. Can use the state of react itself to do, try to control itself. That is, if you are stubborn in a project, you can manage complex states without redux-- please take a look at the three principles of redux--
generally control the status of word components

.

read this article at noon, and recommends it to you

.
class Parent extends React.Component {
    render() {
        return(
            <div>
                <Child ref={r => this.child = r}/>
            </div>
        );
    }
    
    myFunction() {
        this.child.childFunction();
    }
}

class Child extends React.Component {
    render() {
        //....
    }
    
    childFunction() {
    
    }
}

Note that stateless does not have refs .

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b379c3-34459.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b379c3-34459.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?