Bunlong / react-papaparse

react-papaparse is the fastest in-browser CSV (or delimited text) parser for React. It is full of useful features such as CSVReader, CSVDownloader, readString, jsonToCSV, readRemoteFile, ... etc.
https://react-papaparse.js.org
MIT License
364 stars 61 forks source link

Support in functional Components #57

Closed abdulhadi1995 closed 4 years ago

abdulhadi1995 commented 4 years ago

I added the package and followed the Demo to create a drag or click reader. The problem is when i used the component inside my functional component it gives "cant read onDrag of undefined" error. Does this package not support running on functional components?

Bunlong commented 4 years ago

@abdulhadi1995 It supports both class component and function component. Could you please send me your code below?

abdulhadi1995 commented 4 years ago

Well following is all the steps i followed: first i copied all the code from here : https://github.com/Bunlong/react-papaparse/blob/master/demo/CSVReader2.js Then i created a file called CSVReader2.js inside my components and pasted the code there. after that I simply imported that component inside my page and used it as . ( Note its a next js project). After which i got this error: image

Now i also directly importing the component inside my functional component and change the handlers to the required format but i still got the same error.

Bunlong commented 4 years ago

@abdulhadi1995 Please upgrade react-papaparse to latest version v3.7.3.

abdulhadi1995 commented 4 years ago

Yeah I guess you rolled that out quick coz i had download the package just yesterday xD. Anyhoo thanks alot for your time and God Bless for all the good work that you guys are doing.

Bunlong commented 4 years ago

Thank you so much! You too! You are very welcome. Thanks!