fix gc checkbox

This commit is contained in:
SpikeHD
2022-05-14 14:49:25 -07:00
parent c1878119d0
commit 4c32bf71d1

View File

@@ -23,6 +23,16 @@ export default class Checkbox extends React.Component<IProps, IState> {
}
}
static getDerivedStateFromProps(props: IProps, state: IState) {
if (props.checked !== state.checked) {
return {
checked: props.checked
}
}
return null
}
handleChange = () => {
this.setState({ checked: !this.state.checked })
this.props.onChange()