fris-fruitig / react-firebase-file-uploader

An image uploader for react that uploads images to your firebase storage
https://npm.im/react-firebase-file-uploader
166 stars 45 forks source link

ref error in react 16.x trying to use manual upload #29

Closed geraldhemmers closed 5 years ago

geraldhemmers commented 5 years ago

Hi i'm trying to use the manual upload functionality from the example. when i place the

ref={instance => { this.fileUploader = instance; } } // ⇐ reference the component

I recieve this warning '' Warning: Function components cannot be given refs. Attempts to access this ref will fail.'' and when i try to use 'this.fileUploader.startUpload(file)' i see the following error' Uncaught TypeError: _this.fileUploader.startUpload is not a function'

i'm using react 16.6.3.

Does anybody know how i can solve this. Sorry i'm new to react...so this could be my 'unknown' and maybe only an issue in the example for react 16.x

geraldhemmers commented 5 years ago

Ok nevermnid my issue i used the wrong import statement, swith back from the custom button to the normal and forget the change the import statement back to 'import FileUploader from "react-firebase-file-uploader";

So no uses and no bug