1.4.5 • Published 3 years ago

image-upload-react v1.4.5

Weekly downloads
13
License
MIT
Repository
github
Last release
3 years ago

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

1.4.5

3 years ago

1.4.9

3 years ago

1.3.7

3 years ago

1.3.9

3 years ago

1.3.8

3 years ago

1.3.6

3 years ago

1.3.5

3 years ago

1.3.4

3 years ago

1.3.3

3 years ago

1.2.3

3 years ago

1.2.2

3 years ago

1.1.1

3 years ago

1.2.1

3 years ago

1.1.0

3 years ago

1.0.0

3 years ago