React passing parameter with arrow function in child component
问题 I have these parent and child component, I want to pass click function to select an item in child component. Yet it seems the function in child component become automatically called instead of waiting until the user click the element. To make it clearer here is my parent and child components export class ParentView extends Component { state = { selectedItem: {} } handleClick = (item) => { alert('you click me'); this.setState({selectedItem: item}); } render() { let item = { name: 'Item-1' };