0
我想使用反應數據網(http://adazzle.github.io/react-data-grid/index.html),但我不斷收到錯誤:未捕獲不變違規:addComponentAsRefTo(...):只有ReactOwner可以有裁判
invariant.js:17 Uncaught Invariant Violation: addComponentAsRefTo(...): Only a ReactOwner can have refs. You might be adding a ref to a component that was not created inside a component's `render` method, or you have multiple copies of React loaded.
我曾嘗試卸載軟件包並重新安裝無濟於事。
這裏是我的代碼:
render() {
...
var _rows = [];
for (var i = 1; i < 1000; i++) {
_rows.push({
id: i,
title: 'Title ' + i,
count: i * 1000
});
}
var rowGetter = function(i){
return _rows[i];
};
const columns = [
{
key: 'id',
name: 'ID'
},
{
key: 'title',
name: 'Title'
},
{
key: 'count',
name: 'Count'
}
]
return (
...
<ReactDataGrid
columns={columns}
rowGetter={rowGetter}
rowsCount={_rows.length}
minHeight={277} />
...
)
}
我怎樣才能解決這個問題?
我改變了我的config.js:
...
"npm:[email protected]": {
"classnames": "npm:[email protected]",
"es5-shim": "npm:[email protected]",
"fbjs": "npm:[email protected]",
"object-assign": "npm:[email protected]",
"process": "github:jspm/[email protected]",
//"react": "npm:[email protected]",
"react-contextmenu": "npm:[email protected]",
//"react-dom": "npm:[email protected]",
"ron-react-autocomplete": "npm:ron-react-autocomplete[email protected]"
},
...
而現在它的工作原理。
謝謝,看到我的編輯。但我現在得到:警告:行:'鑰匙'不是一個道具。嘗試訪問它會導致返回undefined。如果您需要在子組件中訪問相同的值,則應將其作爲不同的道具傳遞。 – imperium2335