Skip to content
Advertisement

I want to connect react and firebase

I have problem with Firebase and React. This problem is after click to my add-data button for adding data to database. I get this console.log

Reference_impl.ts:482 Uncaught TypeError: db._checkNotDeleted is not a function at ref (Reference_impl.ts:482:1) at insertData (Modal.js:44:1) at HTMLUnknownElement.callCallback (react-dom.development.js:4164:1) at Object.invokeGuardedCallbackDev (react-dom.development.js:4213:1) at invokeGuardedCallback (react-dom.development.js:4277:1) at invokeGuardedCallbackAndCatchFirstError (react-dom.development.js:4291:1) at executeDispatch (react-dom.development.js:9041:1) at processDispatchQueueItemsInOrder (react-dom.development.js:9073:1) at processDispatchQueue (react-dom.development.js:9086:1) at dispatchEventsForPlugins (react-dom.development.js:9097:1)

Can you see my misstake. I want to make simple CRUD app.

This is my code.

JavaScript

I watched almost all youtube videos, and I can’t solve this problem.

Advertisement

Answer

You are using 'firebase/database' SDK that is used for Firebase Realtime Database. For Firestore, you should use 'firebase/firestore' so that should be:

JavaScript

Then import db where required:

JavaScript

This should add a new document in messages collection. Checkout the documentation and this video on Firebase channel for more information.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement