# 和外部组件通信 - order: 2 联动 checkbox。 --- ````jsx var Checkbox = antd.Checkbox; var container = document.getElementById('components-checkbox-demo-controller'); var App = React.createClass({ getInitialState() { return { checked: true, disabled: false } }, render() { var label = (this.state.checked ? '选中' : '取消') + '-' + (this.state.disabled ? '不可用' : '可用'); return

; }, toggleChecked(e) { this.setState({checked: !this.state.checked}); }, toggleDisable(e) { this.setState({disabled: !this.state.disabled}); }, onChange(e) { console.log('checked = ', e.target.checked); this.setState({ checked: e.target.checked }); } }); React.render(, container); ````