So I am fairly new to this but I am watching a tutorial on setting up firebase for a react app. followed the code exactly and I still cannot get it to work. any pointer would help tremendously. thanks.
this is my firebase.js file
import firebase from "firebase";
const firebaseApp = firebase.initializeApp({
apiKey: "AIzaSyA4iXlWakrCkRZhZnF24w0oDOhg8tuHZwM",
authDomain: "ig-clone-53312.firebaseapp.com",
projectId: "ig-clone-53312",
storageBucket: "ig-clone-53312.appspot.com",
messagingSenderId: "975520243361",
appId: "1:975520243361:web:18160e292d3b21d8fe1ae0"
});
const db = firebaseApp.firestore();
const auth = firebase.auth();
const storage = firebase.storage();
export { db, auth, storage };
this is the app.js file that I'm trying to import it into.
import { db, auth, storage} from './firebase';
import React, { useState, useEffect } from 'react';
import './App.css';
import Post from './Post'
function App() {
const [post, setPosts] = useState([]);
useEffect(() => {
db.collection('posts').onSnapshot(snapshot => {
setPosts(snapshot.docs.map(doc => doc.data()));
})
}, [])
return (
<div className="app">
<div className="app__header" >
<img className="app__headerImage" src="https://www.instagram.com/static/images/web/mobile_nav_type_logo.png/735145cfe0a4.png" alt="" />
</div>
{
post.map(post => (
<Post username={post.username} caption={post.caption} imageUrl={post.imageUrl}/>
))
}
<Post username={post.username} caption={post.caption} imageUrl={post.imageUrl} />
<Post username={post.username} caption={post.caption} imageUrl={post.imageUrl}/>
<Post />
</div>
);
}
export default App;
i am also receiving this error
Module not found: Error: Package path . is not exported from package C:\Users\Kyle\Desktop\instagram-clone\ig-clone\node_modules\firebase (see exports field in C:\Users\Kyle\Desktop\instagram-clone\ig-clone\node_modules\firebase\package.json) Did you mean './firebase'?
any advice?