First, create ref hook for your input.
xxxxxxxxxx
const inputFile = useRef(null)
xxxxxxxxxx
<input type='file' id='file' ref={inputFile} style={{display: 'none'}}/>
xxxxxxxxxx
const onButtonClick = () => {
// `current` points to the mounted file input element
inputFile.current.click();
};