I am sending some data to the database through a post request, and I have a checkbox in my app that I need to handle with a state
I am using this library which is confusing me a bit.
Here I have my checkbox in the render method
<Checkbox value="Active" ref="Active" defaultChecked={true} onCheck={this._isChecked} />
and the function to handle it
_isChecked = () => {
console.log('Checked: ');
}
I need it to be checked = true by default.
Now, here I have the function I am using in order to send the data to the post request
_addDealer = () => {
CreateDealersActions.createDealer({
DealerName : this.refs.DealerName.getValue(),
CardId : this.refs.CardId.getValue(),
NickName : this.refs.NickName.getValue(),
Picture : 'http://lorempixel.com/150/150/',
Active : // HERE I NEED TO SET THE VALUE OF THE CHECKBOX
LegalId : this.refs.LegalId.getValue(),
TypeId : this.refs.TypeId.getValue(),
});
}
Look at the Active : // HERE I NEED TO SET THE VALUE OF THE CHECKBOX part in that function, there is where I need to put the value of the check box.
So, what should I know in order to send the proper data in the key Active, as I am using this library, do I need to put state? Or is there any other way?