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报错的更多相关文章

  1. wepy开发小程序eslint报错error 'getApp' is not defined no-undef

    wepy开发小程序使用getApp().globalData保存全局数据很方便,但是会在控制台看到很多报错:“error 'getApp' is not defined no-undef”,这是esl ...

  2. VScode eslint-plugin-vue 自动修复eslint报错

    1.安装插件 npm i -g eslint-plugin-vue 2.修改项目跟路径下的文件:.eslintrc | .eslint.js 3.添加eslint 和 vetur 插件 4.修改vsc ...

  3. VUE项目Eslint报错

    前言:eslint很恶心的一个地方:你是否被各种语法报错一个标点符号,一个空格,一个回车......各种报错折磨着你! 加上编辑器 VS Code 的自动格式化稳稳的和Eslint冲突报错. 对此,我 ...

  4. vue eslint报错解决办法

    若提示入下图时,在build / webpack.base.conf.js中, 找到 // const createLintingRule = () => ({// test: /\.(js|v ...

  5. vue中eslint报错的解决方案

    1,Newline required at end of file but not found. (eol-last) //文末需要一行 这个是报错: 这个是不报错的: 只需要在最后一行加上一空行即可 ...

  6. angular中datetime-local属性使用ng-model报错

    项目需求是将年月日格式更改为年月日时分的格式展示,翻遍了整个项目没找到符合的组件,自己现敲一个也来不及,只好直接使用原生自带的组件--datetime-local.之前都是用的vue写项目,第一次接触 ...

  7. Eslint报错整理与解决方法(持续整理)

    1.'Unexpected tab character' 字面意思理解呢就是意想不到的制表符,当时出现的时候就是我习惯的使用Tab键去打空格,但是eslint默认不认可Tab,所以解决方法很简单: 在 ...

  8. Eslint报错整理与解决方法

    1.‘Unexpected tab character’ 字面意思理解呢就是意想不到的制表符,当时出现的时候就是我习惯的使用Tab键去打空格,但是eslint默认不认可Tab,所以解决方法很简单: 在 ...

  9. NonSerialized 属性忽略序列化报错'NonSerialized' is not valid on this declaration type

    [XmlIgnore] [NonSerialized] public List<string> paramFiles { get; set; } //I get the following ...

随机推荐

  1. USB设备驱动程序学习笔记(一)

    现象:把USB设备接到PC1. 右下角弹出"发现android phone"2. 跳出一个对话框,提示你安装驱动程序 问1. 既然还没有"驱动程序",为何能知道 ...

  2. SimpleDateFormat转换时间,12,24时间格式

    Date d = new Date(); SimpleDateFormat ss = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");//1 ...

  3. LTDC/DMA2D—液晶显示

    本章参考资料:<STM32F4xx 参考手册 2>.<STM32F4xx 规格书>.库帮助文档<stm32f4xx_dsp_stdperiph_lib_um.chm> ...

  4. buildroot 搭建ftpd 服务器记录

    vsftpd 搭建失败,应该是buildroot 文件系统还有操作没有理解透,还需要不断的学习. 所以用轻量级的 ftpd 进行替代, 步骤如下: // ---> make busybox-me ...

  5. 关于datatable导出execl

    导出主要考虑响应流的问题 curContext.Response.ContentType = "application/vnd.ms-excel"; curContext.Resp ...

  6. Linux ad7606 驱动

    Linux中已经移植好了ad7606,位于driver/staging/iio/adc/目录中.只要在板级文件中添加device中即可. 移植参考文档: https://wiki.analog.com ...

  7. Spring IO platform 简介

    前提:熟悉Spring基础知识. 简介:Spring IO Platform将 the core Spring APIs 集成到一个Platform中.它提供了Spring portfolio中的大量 ...

  8. 每个 case 语句的结尾不要忘了加 break,否则将导致多个分支重叠

    每个 case 语句的结尾不要忘了加 break,否则将导致多个分支重叠 (除非有意使多个分支重叠). #include <iostream> /* run this program us ...

  9. 帝国CMS“建立目录不成功!请检查目录权限”的解决办法

    初次安装帝国CMS就遇到了一个问题,在提交或者修改信息的时候提示“建立目录不成功!请检查目录权限”,无法生成页面.检查了文件夹的读写权限和用户访问权限,发现都一切正常.那么到底是哪里出错了呢? 其实是 ...

  10. Javascript的setTimeOut和setInterval的定时器用法

    setTimeout() 方法用于在指定的毫秒数后调用函数或计算表达式,而setInterval()则是在每隔指定的毫秒数循环调用函数或表达式, 直到 clearInterval把它清除.也就是说se ...