how do i get csv data in reactjs to store into state?

as per the documentation this is the approach

React.useEffect(() => {
    Papa.parse("../Assets/images/state_wise_data.csv", {
        download: true,
        complete: data => {
            setRows(data.data);
        }
    });
}, []);

demo

if you are having errors check console.log(data); inside complete callback

here is a complete example

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top