I am following a tutorial and firebase.firestore.FieldValue.serverTimestamp() is used in the code to set timestamp prop as the server timestamp.
import firebase from "firebase";
const someFunction = () => {
addDoc(collection(db, `rooms/${roomId}/messages`), {
message: input,
name: user.displayName,
timestamp: firebase.firestore.FieldValue.serverTimestamp(),
}).then((res) => getMessagesData());
};
But I get this error.
Module not found: Can't resolve 'firebase' in ...
I suppose firebase had some kind of update that we don't import it with import firebase from "firebase"; anymore? What should I do to use the servertimestamp()?