Socket
Socket
Sign inDemoInstall

image-upload-react

Package Overview
Dependencies
86
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    image-upload-react

react image picker


Version published
Weekly downloads
109
decreased by-18.05%
Maintainers
1
Install size
42.8 MB
Created
Weekly downloads
 

Readme

Source

image-upload-react

react image picker

NPM JavaScript Style Guide

Demo

Alt text Alt text

Install

npm install --save image-upload-react

Usage

import React, { useState } from 'react'
import ImageUpload from 'image-upload-react'
//important for getting nice style.
import 'image-upload-react/dist/index.css'

function App() {
  const [imageSrc, setImageSrc] = useState()

  const handleImageSelect = (e) => {
    setImageSrc(URL.createObjectURL(e.target.files[0]))
  }

  return (
    <ImageUpload
      handleImageSelect={handleImageSelect}
      imageSrc={imageSrc}
      setImageSrc={setImageSrc}
      style={{
        width: 700,
        height: 500,
        background: 'gold'
      }}
    />
  )
}

export default App

Docs

PropertyDescriptionRequired
handleImageSelectfunction that will get fired when the user pick an image and we will update the state with the piacked filetrue
imageSrcpeace of state to keep track of the slected filetrue
setImageSrcfunction that will update the value in the statetrue
stylestyle object to style the parent div for the ImageUpload componentfalse

License

MIT © Abd-Alwahab

Keywords

FAQs

Last updated on 15 Aug 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc