-
Notifications
You must be signed in to change notification settings - Fork 62
Sample of using CSVReader isSet
Bunlong VAN edited this page Sep 9, 2020
·
1 revision
import React from 'react'
import { CSVReader } from 'react-papaparse'
export default class CSVReader1 extends React.Component {
state = {
isReset: true,
}
handleOnDrop = (data) => {
console.log('---------------------------')
console.log(data)
console.log('---------------------------')
}
handleOnError = (err, file, inputElem, reason) => {
console.log(err)
}
handleOnRemoveFile = (data) => {
console.log('---------------------------')
console.log(data)
console.log('---------------------------')
}
handleReset = () => {
this.setState({isReset: !this.state.isReset})
}
render() {
return (
<>
<CSVReader
isReset={this.state.isReset}
onDrop={this.handleOnDrop}
onError={this.handleOnError}
addRemoveButton
onRemoveFile={this.handleOnRemoveFile}
>
<span>Click to upload.</span>
</CSVReader>
<button onClick={() => this.handleReset()}>Reset</button>
</>
)
}
}