New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

react-csv-reader

Package Overview
Dependencies
Maintainers
1
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-csv-reader

React component that handles csv file input.

Source
npmnpm
Version
1.2.2
Version published
Weekly downloads
56K
18.24%
Maintainers
1
Weekly downloads
 
Created
Source

react-csv-reader

license npm version npm

React component that handles csv file input.
It handles file input and returns its content as a matrix.

You can try it out in a demo on Codesandbox.

Support me on Patreon!

Installation

Install the package with either yarn or npm.

With yarn:

yarn add react-csv-reader

With npm:

npm install --save react-csv-reader

Usage

import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import CSVReader from 'react-csv-reader'

class App extends Component {
  ...

  render() {
    return (
      <CSVReader
        cssClass="csv-reader-input"
        label="Select CSV with secret Death Star statistics"
        onFileLoaded={this.handleForce}
        onError={this.handleDarkSideForce}
        inputId="ObiWan"
        inputStyle={{color: 'red'}}
      />
    )
  }
}

ReactDOM.render(<App />, document.getElementById('root'))

Parameters

NameTypeDefaultDescription
cssClassstringcsv-reader-inputA CSS class to be applied to the wrapper element.
cssInputClassstringcsv-inputA CSS class to be applied to the <input> element.
labelstring, elementIf present, it will be rendered in a <label> to describe input aim.
onFileLoadedfunction(required) The function to be called passing loaded results.
onErrorfunctionError handling function.
parserOptionsobject{}PapaParse configuration object override
inputIdstringAn id to be applied to the <input> element.
inputStyleobject{}Some style to be applied to the <input> element.

Results

When the file has been loaded, it will be parsed with PapaParse from a CSV formatted text to a matrix. That matrix is returned to the parent component with onFileLoaded function (it will be passed as an argument). The second argument to onFileLoaded will be the filename provided

FAQs

Package last updated on 19 Jan 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts