Last active
June 16, 2019 17:57
-
-
Save jsmanifest/b548543e3582e4e902233738d24b7b32 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import useApp from './useApp' | |
import FileUploader from './FileUploader' | |
import FileUploaderScreen from './FileUploaderScreen' | |
import './styles.css' | |
const App = ({ children }) => { | |
const inputRef = React.createRef() | |
const { | |
files, | |
pending, | |
next, | |
uploading, | |
uploaded, | |
status, | |
onSubmit, | |
onChange, | |
triggerInput, | |
} = useApp({ inputRef }) | |
return ( | |
<form className="form" onSubmit={onSubmit}> | |
<FileUploader | |
triggerInput={triggerInput} | |
inputRef={inputRef} | |
onChange={onChange} | |
> | |
<FileUploaderScreen /> | |
</FileUploader> | |
<div> | |
{files.map(({ file, src, id }, index) => ( | |
<div key={`file-row${index}`}> | |
<img src={src} alt="" /> | |
<div>{file.name}</div> | |
</div> | |
))} | |
</div> | |
</form> | |
) | |
} | |
export default App |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment