解决reactjs标签引入echarts.js 报错Cannot read property 'getAttribute' of null问题

我目前正在学习使用页面引用reactjs库,不配置nodejs和webpack等环境,做项目。
昨天使用echarts的时候,遇到问题,总是报错:Cannot read property 'getAttribute' of null。找了很多文档,没有怎么看明白,自己调试了很久才发现,是没有获取到元素,因为reactjs标签不能使用id,所以我就使用了ref解决这个问题。因为是新手,所以写作水平和一些用词不够好,直接贴图好了。
解决reactjs标签引入echarts.js 报错Cannot read property 'getAttribute' of null问题
然后在周期函数componentWillUpdate()中获取元素;

解决reactjs标签引入echarts.js 报错Cannot read property 'getAttribute' of null问题
将this.refs.chart传给this.drawCharts方法;

解决reactjs标签引入echarts.js 报错Cannot read property 'getAttribute' of null问题

我一开始是在componentWillMount()方法中打印this.refs.chart,很显然得出的结果是undefined。