2017-04-27 11:18:12 +00:00
|
|
|
# Usage
|
|
|
|
|
2017-08-26 05:06:30 +00:00
|
|
|
After creating a Firebase project and installing the library, you can then use it in your project by importing the library in your JavaScript code:
|
2017-04-27 11:18:12 +00:00
|
|
|
|
|
|
|
```javascript
|
2017-08-26 05:04:17 +00:00
|
|
|
import firebase from 'react-native-firebase';
|
2017-04-27 11:18:12 +00:00
|
|
|
```
|
|
|
|
|
2017-08-26 05:04:17 +00:00
|
|
|
As the default app is pre-initialized natively there is no need to call `initializeApp` for the default app instance. Just import and go:
|
2017-04-27 11:18:12 +00:00
|
|
|
|
|
|
|
```javascript
|
2017-08-26 05:04:17 +00:00
|
|
|
import firebase from 'react-native-firebase';
|
2017-04-27 11:18:12 +00:00
|
|
|
|
2017-08-26 05:04:17 +00:00
|
|
|
firebase.auth().signInAnonymously()
|
|
|
|
.then((user) => {
|
|
|
|
console.log(user.isAnonymous);
|
|
|
|
});
|
|
|
|
```
|
2017-04-27 11:18:12 +00:00
|
|
|
|
2017-08-26 05:04:17 +00:00
|
|
|
### Configure Default App Instance
|
2017-04-27 11:18:12 +00:00
|
|
|
|
2017-08-26 05:46:37 +00:00
|
|
|
See [configure the default app instance](/core/config-default-app).
|
2017-04-27 11:18:12 +00:00
|
|
|
|
2017-08-26 05:04:17 +00:00
|
|
|
### Configuring RNFirebase
|
2017-04-27 11:18:12 +00:00
|
|
|
|
2017-08-26 05:46:37 +00:00
|
|
|
See [configure RNFirebase](/core/config-rnfirebase).
|
2017-04-27 11:18:12 +00:00
|
|
|
|