@axetroy/react-download
Version:
[](https://greenkeeper.io/)
60 lines (41 loc) • 1.1 kB
Markdown
[](https://greenkeeper.io/)
react component for click and then download the specify content file.
[](https://axetroy.github.io/react-download/)
```bash
npm install @axetroy/react-download
```
```javascript
import React from 'react';
import { render } from 'react-dom';
import Download from '@axetroy/react-download';
const element = document.createElement('div');
document.body.appendChild(element);
class App extends React.Component {
render() {
return (
<div>
<Download file="test.md" content="# hello world">
<button type="button">Click and Download file</button>
</Download>
</div>
);
}
}
render(<App />, element);
```
- file
download file name
- content
the file content you want to download
```bash
git clone https://github.com/axetroy/react-download.git
yarn
yarn start
```
The [MIT License](https://github.com/axetroy/react-download/blob/master/LICENSE)