How react child components call methods in parent components

File A

wrote some methods

class Parents extends Component{
    scrollWidth(){
        let dataWidth = this.state.columns;
        let result = 0;
        for(let i=0;i<dataWidth.length;iPP){
            result+=dataWidth[i].width
        }
        return result
    }
    
    
    change() {
        console.log(xxxx)
    }
    
    one(){
        console.log(bbbbb)
    }
}

File B
how do you want to call the methods in the file, there is no render, in file A, just a lot of methods are saved.

class Son extends Component{
    scrollWidth  changeone

    render(){
        return(
            <div ></div>
        )
    }
}
Mar.11,2021

1. Look at your current code An and B do not have any relationship, if B is a component of A, you can pass in
2 through props. If you just want to use the method of An as a public method, you can write a public js, that does not need to inherit component, to import, directly in b and then can call the method of b. But the this called at this time does not point to an instance of component B, so it is called with
change.call (this) such

.
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-1b3825b-2c0e3.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-1b3825b-2c0e3.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?