React - how to capture only parent's onClick event and not children
问题 I have part of a React Component that looks like this: var headerElement = someBoolean ? <input/> : 'some string'; return <th onClick={this._onHeaderClick}>{headerElement}</th>; And a click handler for the th element: _onHeaderClick(event) { event.preventDefault(); console.log(event.target); }, I want to capture the th element. It works fine when headerElement is 'some string', but when it is an input element, the input element is the one referenced in the event.target property. What's the