Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Adi Hermawan skinnyguy

🎯
Focusing
  • Coder Eternity
  • 127.0.0.1
View GitHub Profile
@skinnyguy
skinnyguy / downloadcsv.js
Created Dec 19, 2020
Generated data into csv with papaparse in javascript
View downloadcsv.js
function downloadCSV(csvTitle = "", csvHeader = [], csvData = []) {
// create filename using today unix time
const today = new Date().getTime()
const fileName = "Download-" + today + ".csv";
// Create title for csv
const title = csvTitle || "Download CSV example"
// Add header into first row
csvData.splice(0, 0, csvHeader)
View index.jsx
import React from 'react'
class Header extends React.Component {
super (props){
this.state = ""
}
render () {
return (
<div>