I\'m having trouble to update the checkbox state after it\'s assigned with default value checked="checked"
in React.
var rCheck = React
this can be done with pure js
//Load category to form : to edit
GetCategoryById(id) {
this.UpdateId = id
axios.get('http://localhost:4000/Category/edit/' + id)
.then(response => {
this.setState({
category_name: response.data.category_name,
category_description: response.data.category_description,
is_active: response.data.is_active,
});
response.data.is_active == 1 ? document.getElementById("categoryStatus").checked = true : document.getElementById("categoryStatus").checked = false;
})
.catch(function (error) {
console.log(error);
})
}