I am using React-Dropzone and following the first example on the website:
function MyDropzone() {
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop });
return (
<div {...getRootProps()}>
<input {...getInputProps()} />
Hello
</div>
);
}
I want to create a wrapper class like this:
function MyDropzone() {
const { getRootProps, getInputProps, isDragActive } = useDropzone({ onDrop });
function Wrapper({ children }) {
return (
<div {...getRootProps()}>
<input {...getInputProps()} />
{children}
</div>
);
}
return <Wrapper>Hello</Wrapper>;
}
but when I do this, react-dropzone stops working. When I click the element, nothing happens whereas on the first example it works fine. Isn't this how wrapper components work or am I missing something?