I\'m a beginner in React, and I\'m a little confused about calling a function in React.
I saw the following ways and I don\'t know when to use each and which one.
<
You can trigger events with this.props.someProps()
. Check the following sample.
import React, { Component } from 'react';
class AddToDo extends Component {
render() {
return (
)
}
}
class Todos extends Component {
handleAddToDo(ev, someVal) {
// do something
}
render() {
return (
this.handleAddToDo(ev, someVal)} />
)
}
}
export default Todos;