Reactjs react固定数据表的意外令牌错误
我正在尝试使固定数据表示例正常工作:Reactjs react固定数据表的意外令牌错误,reactjs,fixed-data-table,Reactjs,Fixed Data Table,我正在尝试使固定数据表示例正常工作: import React from 'react'; import ReactDOM from 'react-dom'; import {Table, Column, Cell} from 'fixed-data-table'; // Table data as a list of array. const rows = [ ['a1', 'b1', 'c1'], ['a2', 'b2', 'c2'], ['a3', 'b3', 'c3'],
import React from 'react';
import ReactDOM from 'react-dom';
import {Table, Column, Cell} from 'fixed-data-table';
// Table data as a list of array.
const rows = [
['a1', 'b1', 'c1'],
['a2', 'b2', 'c2'],
['a3', 'b3', 'c3'],
// .... and more
];
// Render your table
module.exports = React.createClass({
render: function() {
return (
<Table
rowHeight={50}
rowsCount={rows.length}
width={200}
height={200}
headerHeight={50}>
{/*if I have just this column, the page will render*/}
<Column
header={<Cell>Col 1</Cell>}
cell={<Cell>Column 1 static content</Cell>}
width={500}
/>
{/*This column causes the error*/}
<Column
header={<Cell>Col 3</Cell>}
cell={({rowIndex, ...props}) => (
<Cell {...props}>
Data for column 3: {rows[rowIndex][2]}
</Cell>
)}
width={500}
/>
</Table>
);
}
});
假设您安装并启用了正确的转换(对于您需要的Babel 6),您可能会遇到:
导出默认值({title,…other})=>{
//做点什么
};
输出失败
SyntaxError:test-fn-spread.js:绑定右值(1:26)
>1 |导出默认值({title,…other})=>{
| ^
2 |//做点什么
3 | };
6.1.2中的错误。您在JSX Transfilation中使用了什么?有一次,我遇到了完全相同的问题,下面是另一种使固定数据表工作的方法:固定数据表现在已经停止使用。这就是我们发布React端口的原因-我没有所有正确的转换。我需要添加“babel插件转换对象rest spread”。谢谢
Module build failed: SyntaxError: C:/xxxx/Sample.jsx: Unexpected token (33:24)
31 | <Column
32 | header={<Cell>Col 3</Cell>}
> 33 | cell={({rowIndex, ...props}) => (
| ^
34 | <Cell {...props}>
35 | Data for column 3: {rows[rowIndex][2]}
36 | </Cell>
var path = require('path');
module.exports = {
context: path.join(__dirname, 'server/components'),
entry: [
'webpack-dev-server/client?http://localhost:8090',
'webpack/hot/only-dev-server',
"./entry.jsx"
],
module: {
loaders: [
{
test: /\.jsx$/,
exclude: /node_modules/,
loaders: ['react-hot', 'babel-loader'],
}
]
},
output: {
path: __dirname + '/server/public/js/build',
filename: 'bundle.js',
publicPath: 'http://localhost:8090/js/build/'
},
resolve: {
extensions: ['', '.js', '.jsx'],
}
};