0
我創建一個通用的功能checkField
我的形式,我希望能夠從國家提取(或任何JavaScript對象),我作爲參數傳遞變量別名ES6 destructuration
checkField(fieldname) {
const {
validityFieldObj,
fieldname
} = this.state
// Would be equivalent to `this.state[fieldname]`
// But I can't get fieldname from this.state destructuration,
// as it as already been delcared in the parameter.
// Any alternative to this issue?
}
非常漂亮,它完美的作品! – dbrrt
@dbrrt - 歡迎:) –