File tree 1 file changed +18
-0
lines changed
supports/create-next-app/src/app
1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 6
6
useCSVReader ,
7
7
lightenDarkenColor ,
8
8
formatFileSize ,
9
+ useCSVDownloader ,
9
10
} from 'react-papaparse'
10
11
11
12
const GREY = '#CCC'
@@ -83,6 +84,7 @@ const styles = {
83
84
84
85
export default function Home ( ) {
85
86
const { CSVReader } = useCSVReader ( )
87
+ const { CSVDownloader } = useCSVDownloader ( )
86
88
const [ zoneHover , setZoneHover ] = useState ( false )
87
89
const [ removeHoverColor , setRemoveHoverColor ] = useState (
88
90
DEFAULT_REMOVE_HOVER_COLOR
@@ -157,6 +159,22 @@ export default function Home() {
157
159
</ >
158
160
) }
159
161
</ CSVReader >
162
+
163
+ < CSVDownloader
164
+ filename = { 'filename' }
165
+ data = { ( ) => {
166
+ return [
167
+ {
168
+ "Column 1" : "1-1" ,
169
+ "Column 2" : "1-2" ,
170
+ "Column 3" : "1-3" ,
171
+ "Column 4" : "1-4" ,
172
+ }
173
+ ] }
174
+ }
175
+ >
176
+ Download
177
+ </ CSVDownloader >
160
178
</ main >
161
179
)
162
180
}
You can’t perform that action at this time.
0 commit comments