score:3

Accepted answer

<img> knows how to use onClick. But <OutstandingActionsSummary> doesn't! In the implementation of <OutstandingActionsSummary>, you have to specify how to use the property. It should look like:

class OutstandingActionsSummary extends Component {
    render() {
        return <img onClick={this.props.onClick}/>
}

score:0

In OutstandingActionForm use only {this.props.children} and attach click handler on OutstandingActionsSummary and call its parent OutstandingActionForm to process.

score:1

class OutstandingActionsSummary extends Component {
    static defaultProps ={
        onClick:function(){}
    }
    render() {
        return (
              <img onClick={()=>this.props.onClick()} src={'/assets/notification.jpg'} className="notification-icon"/>
    )
}

OutstandingActionsSummary doesnot support onClick,add it.


Related Query

More Query from same tag