I have been confused about some syntaxes in ReactJS, one is that when I define a function inside one Reactjs class, I can not use function keyword, but when I moved the function outside the class then I have to add keyword function before the signature. Second is that if I write a function inside the render(), then I have to use arrow function. For example, why the following is wrong:
class Test extends Component{
constructor(props){
super(props)
}
function test(){
//this is wrong,I need to remove function keyword
}
render(){
mytest(){
//also this is wrong,I only can use arrow function
}
}
}