There is similar questions in stackoverflow but none of that fixed my issues... Maybe because that questions are old and the solutions for older versions.... So I tried different methods I saw but none of it helped still showing the same error.. please help me fix it friends...
Create.js file:
import { FirebaseContext, AuthContext } from '../../store/Context';
const { firebase } = useContext(FirebaseContext);
const handleSubmit = () => {
firebase.storage().ref(`/image/${image.name}`).put(image).on('state_changed').then(({ ref }) => {
ref.getDownloadURL().then((url) => {
console.log(url);
})
})
}
return (
<Fragment>
<button className="uploadBtn" onClick={handleSubmit}>Upload and Submit</button>
<Fragment/>
)
I have added only the necessary parts here. The firebase config file has the following imports:
import 'firebase/compat/auth';
import 'firebase/compat/firestore';
import 'firebase/storage'
I am doing my project in React.