custom-react-uploader
v0.0.15
Published
```typescript import React, { useEffect, useState } from 'react' import Uploader, { convertUrlToUploadFileModel, UploadFileModel } from 'custom-react-uploader' import styles from './styles.module.scss' const testUrl = `https://media.istockphoto.com/p
Downloads
6
Maintainers
Readme
Custom React Uploader
Usage
One line of code worths thousands lines of explanations.
import React, { useEffect, useState } from 'react'
import Uploader, { convertUrlToUploadFileModel, UploadFileModel } from 'custom-react-uploader'
import styles from './styles.module.scss'
const testUrl = `https://media.istockphoto.com/photos/desk-lamp-picture-id534400418?b=1&k=20&m=534400418&s=170667a&w=0&h=kWgxXtGPOGYwOg5WdvFebM_z3wAQBUG2wrTf24oBWTc=`
const Container: React.FC<any> = () => {
const [images, setImages] = useState<UploadFileModel[]>([])
useEffect(() => {
convertUrlToUploadFileModel(testUrl, 'testName.jpg').then((res) => {
setImages([res])
})
}, [])
return <div className={styles.container}>
<Uploader currentFiles={images} updateCurrentFiles={setImages} onError={(message, file) => {
console.log('error ', message, file)
}} multiple={true}
onlyShowFileInfo={false}
/>
</div>
}
export default Container
Development
- Git clone the project
https://github.com/duc168/custom-react-uploader.git
- Install lerna globally if you have not installed lerna yet, run
yarn add lerna -g
- Run
yarn
to install the first packages yarn start
to start developingyarn stop
to stop developingyarn build
to build a new version