Skip to content

React component to download file with cached data

Notifications You must be signed in to change notification settings

HerrGustav/react-download-link

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

react-download-link

A simple component to download data from a client-side cache (e.g. flux, redux).

Design to be used with browserify or webpack.

Install with:

npm install --save react-download-link

Include with:

import DownloadLink from "react-download-link";

Use:

<DownloadLink
	label="Save"
	filename="myfile.txt"
	exportFile={() => "My cached data"}
/>

Or with Promises:

<DownloadLink
	label="Promise to Save"
	filename="myfile.txt"
	exportFile={() => Promise.resolve("My cached data")}
/>

The component will default to an anchor tag, but the tagName prop will accept a string of any other HTML tag you prefer, such as 'button'.

About

React component to download file with cached data

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%