ref 属性使用eslint报错
react 使用 ref 报错 ,[eslint] Using string literals in ref attributes is deprecated. (react/no-string-refs)
报错1:
var Hello = createReactClass({
componentDidMount: function() {
var component = this.refs.test; },
render: function() {
return <div ref="test">ref, test.</div>;
}
}); 正确:
var Hello = createReactClass({
componentDidMount: function() {
var component = this.test; },
render() {
return <div ref={(c) => { this.test = c; }}>test, ref.</div>;
}
});
ref 属性使用eslint报错的更多相关文章
- wepy开发小程序eslint报错error 'getApp' is not defined no-undef
wepy开发小程序使用getApp().globalData保存全局数据很方便,但是会在控制台看到很多报错:“error 'getApp' is not defined no-undef”,这是esl ...
- VScode eslint-plugin-vue 自动修复eslint报错
1.安装插件 npm i -g eslint-plugin-vue 2.修改项目跟路径下的文件:.eslintrc | .eslint.js 3.添加eslint 和 vetur 插件 4.修改vsc ...
- VUE项目Eslint报错
前言:eslint很恶心的一个地方:你是否被各种语法报错一个标点符号,一个空格,一个回车......各种报错折磨着你! 加上编辑器 VS Code 的自动格式化稳稳的和Eslint冲突报错. 对此,我 ...
- vue eslint报错解决办法
若提示入下图时,在build / webpack.base.conf.js中, 找到 // const createLintingRule = () => ({// test: /\.(js|v ...
- vue中eslint报错的解决方案
1,Newline required at end of file but not found. (eol-last) //文末需要一行 这个是报错: 这个是不报错的: 只需要在最后一行加上一空行即可 ...
- angular中datetime-local属性使用ng-model报错
项目需求是将年月日格式更改为年月日时分的格式展示,翻遍了整个项目没找到符合的组件,自己现敲一个也来不及,只好直接使用原生自带的组件--datetime-local.之前都是用的vue写项目,第一次接触 ...
- Eslint报错整理与解决方法(持续整理)
1.'Unexpected tab character' 字面意思理解呢就是意想不到的制表符,当时出现的时候就是我习惯的使用Tab键去打空格,但是eslint默认不认可Tab,所以解决方法很简单: 在 ...
- Eslint报错整理与解决方法
1.‘Unexpected tab character’ 字面意思理解呢就是意想不到的制表符,当时出现的时候就是我习惯的使用Tab键去打空格,但是eslint默认不认可Tab,所以解决方法很简单: 在 ...
- NonSerialized 属性忽略序列化报错'NonSerialized' is not valid on this declaration type
[XmlIgnore] [NonSerialized] public List<string> paramFiles { get; set; } //I get the following ...
随机推荐
- PeekMessage、GetMessage的区别
在Windows编程中经常使用这两个函数来处理消息,它们之间的区别就是GetMessage是阻塞的,PeekMessage是非阻塞的. GetMessage原型如下:BOOL GetMessage(L ...
- uC/OS-III 概要
本章主要对 uC/OS-III 实时操作系统做一些概要介绍,使读者对 uC/OS-III 有个整体的浅 认识,为后面的章节的详细讲解做一个铺垫. 下图是 uC/OS-III 系统从底层到上层的文件结构 ...
- RDLC设计
1.rdlc报表的日期格式"yyyy/mm/dd 00/00/00"转换为"yyyy-mm-dd" =System.Convert.ToDateTime(Fie ...
- redis 最优雅的错误提示
Exception in thread "main" redis.clients.jedis.exceptions.JedisDataException: DENIED Redis ...
- Unity3D中的序列化测试
Unity3D中序列化字段常使用[SerializeField],序列化类常采用[System.Serializable],非序列化采用[System.NonSerialized]. 序列化类使用时发 ...
- System类及其getProterties( )和getProperty( )
System这个类来源: public final class System extends Object System类包含若干个有用的类字段和方法,而且不能被实例化.System类提供的工具包括标 ...
- Nginx实战系列之功能篇----后端节点健康检查(转)
公司前一段对业务线上的nginx做了整理,重点就是对nginx上负载均衡器的后端节点做健康检查.目前,nginx对后端节点健康检查的方式主要有3种,这里列出: 1.ngx_http_proxy_m ...
- Linux下如何查看tomcat是否启动/系统日志等
Linux下如何查看tomcat是否启动/系统日志等 查看tomcat是否启动 ps -ef | grep tomcat 或者 ps -ef | grep java 启动tomcat(在tomca ...
- windows 搭建 subversion+TortoiseSVN
1.版本 (a)Apache 2.2.25:httpd-2.2.25-win32-x86-no_ssl.msi (b)Subversion:Setup-Subversion-1.8.5.msi (c) ...
- 我们要注意的Mysql基本安全设置
1.设置或修改Mysql root密码:默认安装后空密码,以mysqladmin命令设置密码: mysqladmin -uroot password "password" Mysq ...