Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to import the Firebase app module from @react-native-firebase.
React Native
import [1] from '@react-native-firebase/app';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using camelCase or underscores in the import name.
Trying to import from a wrong package.
✗ Incorrect
The correct import is 'firebase' from '@react-native-firebase/app' to initialize Firebase in React Native.
2fill in blank
mediumComplete the code to initialize the Firebase app in React Native.
React Native
const app = [1](); Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to call 'initializeApp' directly without firebase.
Using incorrect method names.
✗ Incorrect
Calling 'firebase.app()' returns the initialized Firebase app instance.
3fill in blank
hardFix the error in importing the Firestore module from @react-native-firebase.
React Native
import firestore from '[1]';
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using web Firebase package names.
Omitting the '@' symbol.
✗ Incorrect
The correct package for Firestore in React Native Firebase is '@react-native-firebase/firestore'.
4fill in blank
hardFill both blanks to correctly get a Firestore collection reference.
React Native
const usersCollection = firestore().[1]('[2]');
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'doc' instead of 'collection' for collection reference.
Using wrong collection names.
✗ Incorrect
Use 'collection' method with the collection name 'users' to get the reference.
5fill in blank
hardFill all three blanks to add a document with data to Firestore.
React Native
firestore().[1]('[2]').[3]({ name: 'John', age: 30 });
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'set' without a document reference.
Mixing up collection and document methods.
✗ Incorrect
Use 'collection' to select 'users', then 'add' to insert a new document with data.