Using string literals in ref attributes is deprecated

简介: eslint报错问题 this.setState({ msgCode: text })} ref="MsgCode" />正确格式为下面 用到refs属性时,比如:直接this.

eslint报错问题

<TextInput
              style={styles.textInputStyle}
              underlineColorAndroid="transparent"
              keyboardType="numeric"
              maxLength={11}
              placeholder="请输入收到的验证码"
              placeholderTextColor="#cccccc"
              onChangeText={text => this.setState({ msgCode: text })}
              ref="MsgCode"
            />

正确格式为下面 用到refs属性时,比如:直接this.MsgCode.blur()

   <TextInput
              style={styles.textInputStyle}
              underlineColorAndroid="transparent"
              keyboardType="numeric"
              maxLength={11}
              placeholder="请输入收到的验证码"
              placeholderTextColor="#cccccc"
              onChangeText={text => this.setState({ msgCode: text })}
              ref={(c) => { this.MsgCode = c; }}
            />
目录
相关文章
解决方案:Missing URI template variable ‘userName‘ for method parameter of type String
解决方案:Missing URI template variable ‘userName‘ for method parameter of type String
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
Error: Element type is invalid: expected a string (for built-in components) or a class/function
2550 0
【已解决】Error: Element type is invalid: expected a string (for built-in components) or a class/function
解决Missing cookie ‘JssionId‘ for method parameter of type String问题
解决Missing cookie ‘JssionId‘ for method parameter of type String问题
161 0
|
6月前
|
JavaScript
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
79 1
|
6月前
FeignClient【问题】Cannot deserialize value of type``from Object value (token `JsonToken.START_OBJECT`)
FeignClient【问题】Cannot deserialize value of type``from Object value (token `JsonToken.START_OBJECT`)
806 0
|
人工智能 自然语言处理 语音技术
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
Invalid prop: type check failed for prop “index“. Expected String with value “5“问题解决
120 0
|
Java
【报错】String cannot be resolved to a type解决方案
【报错】String cannot be resolved to a type解决方案
360 1
|
Android开发 Kotlin
【错误记录】Kotlin 编译报错 ( Type mismatch: inferred type is String? but String was expected )
【错误记录】Kotlin 编译报错 ( Type mismatch: inferred type is String? but String was expected )
3158 0
【错误记录】Kotlin 编译报错 ( Type mismatch: inferred type is String? but String was expected )
解决Format string is not a string literal (potentially insecure)问题
在用宏实现部分字符串格式化问题时,stringWithFormat方法会出现【Format string is not a string literal (potentially insecure)】警告
438 0
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题
解决Invalid prop: type check failed for prop “model“. Expected Object, got Array问题