I am trying to render a grid of checkboxes. I can check a checkbox and fire off the handler which updates an array of values.
My problem is when I browse back to the page I would like to see checkboxes with the value in an array checked as default.
Can anyone please tell me how do this? Many thanks
handler: function(e) {
channel.publish({
channel: "contact",
topic: "selectedContact",
data: {
id: e.target.attributes['data-ref'].value
}
});
},
render: function() {
var id = this.props.data.id;
var isSelected = this.props.data.isSelected;
return (
<div className="contact-selector">
<input type="checkbox"
checked={isSelected} data-ref={id}
onClick={this.handler} />
</div>
);
},
I have my selected state being passed as props:
props: Object data: Object contacts: Array[10] 0: Object Id: 13211, isSelected: true
I have a screenshot of the state which holds the isSelected value, but I cant find out how to get that value in the checked property of the component? Do I need to map it somehow?

My initial value is:
this.props.data.isSelected
But the isSelected value is written to the contacts array in the attachment