react-image-to-file
v1.0.3
Published
Allows react web dev implementing the functionality of downloading an image by clicking on a button
Downloads
2
Readme
react-image-to-file
Allows react web dev implementing the functionality of downloading an image by clicking on a button ( Hooks only )
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