I am new in React, and I am still kinda trying to figure out best practices so bear with me.
So, say I have a <ParentComponent /> and a <ChildComponent /> and I want the following behaviour: When the child is clicked, something should happen.
How should I implement the onClick event handler for the <ChildComponent /> ?
Should I define it inside the <ParentComponent />'s class and pass it down to the <ChildComponent />as a prop to use as onClick={this.props.handleClick} or should I define it in the <ChildComponent /> and simply use it with onClick={this.handleClick} ?
Is one method preferred over the other or there is no difference between doing either?