I add a click event inside loop of my react render method before return and the code as it follows
renderedCheckboxes = content.map( function(f, i) {
if ( f['acf_fc_layout'] === 'checkbox' ) {
let id="customCheck" + i;
return (
<li className="list-group-item" key={i}>
<div className="custom-control custom-checkbox">
<input type="checkbox" name={f.checkbox} onClick={this.handleClick.bind(this) } className="custom-control-input" id={id} />
<label className="custom-control-label" htmlFor={id}>{f.label}</label>
</div>
</li>
)
}
});
but as I click on checkbox I get TypeError: Cannot read property 'handleClick' of undefined
What I do wrong in this case?