react-image-to-file
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

react-image-to-file

Allows react web dev implementing the functionality of downloading an image by clicking on a button ( Hooks only )

NPM JavaScript Style Guide

Install

npm install --save react-image-to-file

Usage

import React from 'react'
import { useDownloadImg } from 'react-image-to-file'

const App = () => {
  const downloadImg = useDownloadImg()

  const onDownloadImg = () => {
    downloadImg({elementID: "my-image", fileName: "my-image"})
  }
  
  return (
    <div>
      <img
        id="my-image"
        alt='Your own'
        src='https://source.unsplash.com/random'
      />
      <button onClick={onDownloadImg}>download img</button>
    </div>
  )
}

export default App

License

MIT © hkhattabi

Readme

Keywords

none

Package Sidebar

Install

npm i react-image-to-file

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

16.4 kB

Total Files

9

Last publish

Collaborators

  • hkhattabi