Humdan / react-download

react component for click and then download the specify content file.

Home Page:https://axetroy.github.io/react-download/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

react-download

react component for click and then download the specify content file.

Online Demo

Installation

npm install @axetroy/react-download

Usage

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);

Props

  • file

download file name

  • content

the file content you want to download

Run the Demo

git clone https://github.com/axetroy/react-download.git
yarn
yarn start

License

The MIT License

About

react component for click and then download the specify content file.

https://axetroy.github.io/react-download/

License:MIT License


Languages

Language:JavaScript 96.2%Language:HTML 3.8%