I am trying react-csv. https://www.npmjs.com/package/react-csv
This is data:
users = [
{firtstname: 'Ahmed', lastname: 'Tomi' , email: '[email protected]'},
{firtstname: 'Raed', lastname: 'Labes' , email: '[email protected]'},
{firstname: 'Yezzi', lastname: 'Min l3b', email: '[email protected]'}
];
Data for react-csv:
<CSVLink data={this.props.users} >Download me</CSVLink>
Then, how do I get only lastname and email for csv. I try to do like this but something went wrong.
handleExport = () => {
this.state.exportData = this.props.users.map((user, index) => (
user.lastname + user.email
));
}
Thanks.