我是 js 的新手并对本机做出反应。我对下面的代码有疑问。作为可触摸不透明度的 onpress 属性值给出的函数在应用程序启动时调用,而无需触摸可触摸不透明度。任何人都可以解释屏幕后面发生的事情。有关详细信息,请参阅 hello 方法的内嵌注释。
export default class FirstClass extends Component {
hello(){ // this function is called at launch of application
// itslef .I know if i can use fat arrow function or
// bind function to invoke this wont call at the start
// of application.Can anyone explain why its calling
// automatically in this case and what is the this
// refers to in this method in this case.
console.log('Hai from method hello');
}
render() …Run Code Online (Sandbox Code Playgroud)