简体   繁体   中英

ReactJS/JS/Firebase - Image Upload to Firebase Storage - ERRORS

I have watched every tutorial and all done all the research possible, yet I keep getting errors for my code. An example error (this error keeps occurring for different part of the code) 在此处输入图像描述

In the same file I import import firebase from 'firebase/compat/app' add then const storage = firebase.storage() , in a different file I also import import firebase, {initializeApp} from "firebase/compat/app"; import "firebase/compat/auth"; import "firebase/compat/firestore"; import firebase, {initializeApp} from "firebase/compat/app"; import "firebase/compat/auth"; import "firebase/compat/firestore"; I also tried to import firebase/storage but I had the same problem. Any help would be nice, thank you in advance:)

The syntax for the import firebase/storage should be like this:

import firebase from "firebase/compat/app";

// After you import app...
import "firebase/compat/storage";

You may refer to this documentation about compat libraries .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM