Answer the question
In order to leave comments, you need to log in
Why isn't checked checked?
constructor(props) {
super(props);
const value = props.value || {};
this.state = {
value,
iconLoading: false,
isVisible: props.isVisible,
checked: true,
isEdit: !!props.data,
types: [],
isChecked: props.checked,
data: props.data,
name: '',
email: '',
}
this.handleChange = this.handleChange.bind(this);
}
componentDidMount() {
setPageSettings({
title: 'Создание и предоставление разрешений'
});
this.setState({isLoading: true});
this.fetch();
}
toggleChecked = () => {
this.setState({ checked: !this.state.checked });
};
toggleDisable = () => {
this.setState({ disabled: !this.state.disabled });
};
onChange = e => {
console.log('checked = ', e.target.checked);
this.setState({
checked: e.target.checked,
});
};
fetch = () => {
return api
.get(`/permissions`)
.then(response => {
this.setState({permissions: response.data});
})
.catch(e => {
this.setState({permissions: []});
});
render() {
const {iconLoading, permissions, userData, isLoading} = this.state;
// в форме
<Checkbox value={row.id} key={row.id} checked={this.state.checked}>
{row.id}
</Checkbox>
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question