React File Upload Dialog
npm install @achievewithoutborders/file-upload-clientReact File Upload Dialog
``bash`
$ npm install @achievewithoutborders/file-upload-client --save
#### Props
|Prop name|Description|Default value|Example values|
|----|----|----|----|
|name|Name of field||doctor_name
|text|Value that will be display on screen||Doctor's Name
|onChange|Event that will be called when adding/removing item|() => {}|function(files) { handleOnChange({ index, files })}
|accepts|Array of allowed file types|All|['image/*'] Documentation
`js
import React from 'react'
import FileUpload from '@achievewithoutborders/file-upload-client'
export default function FileUploadPage (props) {
const [items, setItems] = React.useState([
{
name: 'doctors_resume',
text: Doctor's Resume, Copy of Certificate
accepts: ['image/*']
},
{
name: 'copy_of_certificate',
text: ,
accepts: ['application/pdf']
}
])
const handleOnChange = ({ index, files }) => {
setItems(state =>
state.map((item, _index) => {
if (_index === index) item.files = files
return item
})
)
}
return (
``
MIT