Добрый день!В Реакте новичок и столкнулся с проблемой экспорта данных в Excel. Использую плагин react-data-export.
Мой код ниже:
import React, { Component } from 'react';
import './App.css';
import Form from "./Form";
import {ExcelFile, ExcelSheet} from "react-data-export";
const multiDataSet = [
{
columns: ["Name", "Salary", "Sex"],
data: [
["Johnson", 30000, "Male"],
["Monika", 355000, "Female"],
["Konstantina", 20000, "Female"],
["John", 250000, "Male"],
["Josef", 450500, "Male"],
]
},
{
xSteps: 1, // Will start putting cell with 1 empty cell on left most
ySteps: 5, //will put space of 5 rows,
columns: ["Name", "Department"],
data: [
["Johnson", "Finance"],
["Monika", "IT"],
["Konstantina", "IT Billing"],
["John", "HR"],
["Josef", "Testing"],
]
}
];
class App extends Component {
render() {
return (
<div className="App">
<header className="App-header">
<Form>
</Form>
<ExcelFile>
<ExcelSheet dataSet={multiDataSet} name="Organization"/>
</ExcelFile>
</header>
</div>
);
}
}
export default App;
Ошибка такая:
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.
Check the render method of `App`.