import { isEmpty } from 'lodash'
import React, { useRef } from 'react'
export default function FormFile({
label,
onChange,
error,
preview,
inputRef = useRef(),
}) {
return (
{label !== '' && (
)}
{preview && preview}
inputRef.current.click()}
>
Choose File
{isEmpty(inputRef.current?.value)
? 'No choosen file'
: inputRef.current.value}
{error && (
{error}
)}
)
}