레이블 단추를 변경하려고하면 레이블이 읽기 전용 속성이기 때문에 오류가 발생했습니다. 어떻게 버튼 텍스트를 동적으로 변경할 수 있습니까?재질에서 버튼 텍스트를 동적으로 변경하십시오.
export default class Tagger extends Component {
static propTypes = {
name: PropTypes.string
}
constructor(props) {
super(props)
this.state = {
disabled: true
}
this.enableEdit = this.enableEdit.bind(this)
}
componentDidMount() {
this.editButton = React.findDOMNode(this.refs.editButton)
}
enableEdit() {
this.setState({disabled: !this.state.disabled})
this.refs.editButton.props.label = 'Save'
}
render() {
return (
<div>
<RaisedButton onClick={this.enableEdit} label='Modify' primary={true} ref='editButton' />
</div>
)
}
}