From 381b53b6b82e0b98c4818a89de427e8e62d25291 Mon Sep 17 00:00:00 2001 From: strawbrary Date: Mon, 11 Jul 2016 11:07:35 +0800 Subject: [PATCH] Fix: unknown prop 'redraw' warning in React v15.2 React v15.2 warns when a DOM element is rendered with an invalid property (see https://fb.me/react-unknown-prop) --- lib/core.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/core.js b/lib/core.js index 3c06eac..3a0069d 100644 --- a/lib/core.js +++ b/lib/core.js @@ -11,6 +11,7 @@ var Chart = require('chart.js'); module.exports = { createClass: function(chartType, methodNames, dataKey) { + var excludedProps = ['data', 'options', 'redraw']; var classData = { displayName: chartType + 'Chart', getInitialState: function() { return {}; }, @@ -20,7 +21,7 @@ module.exports = { }; for (var name in this.props) { if (this.props.hasOwnProperty(name)) { - if (name !== 'data' && name !== 'options') { + if (excludedProps.indexOf(name) === -1) { _props[name] = this.props[name]; } }