props.firebase
can be accessed on a component by wrapping it with the firebaseConnect
higher order component like so:
import { firebaseConnect } from 'react-redux-firebase'
export default firebaseConnect()(SomeComponent)
// or with decorators
@firebaseConnect()
export default class SomeComponent extends Component {
}
The methods which are available are documented in firebaseInstance
Sets data to Firebase.
Parameters
path
String Path to location on Firebase which to setvalue
(Object | String | Boolean | Number) Value to write to FirebaseonComplete
Function Function to run on complete (not required
)
Examples
Basic
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'
const Example = ({ firebase: { set } }) => (
<button onClick={() => set('some/path', { here: 'is a value' })}>
Set To Firebase
</button>
)
export default firebaseConnect()(Example)
Returns Promise Containing reference snapshot
Pushes data to Firebase.
Parameters
path
String Path to location on Firebase which to pushvalue
(Object | String | Boolean | Number) Value to push to FirebaseonComplete
Function Function to run on complete (not required
)
Examples
Basic
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'
const Example = ({ firebase: { push } }) => (
<button onClick={() => push('some/path', true)}>
Push To Firebase
</button>
)
export default firebaseConnect()(Example)
Returns Promise Containing reference snapshot
Updates data on Firebase and sends new data.
Parameters
path
String Path to location on Firebase which to updatevalue
(Object | String | Boolean | Number) Value to update to FirebaseonComplete
Function Function to run on complete (not required
)
Examples
Basic
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'
const Example = ({ firebase: { update } }) => (
<button onClick={() => update('some/path', { here: 'is a value' })}>
Update To Firebase
</button>
)
export default firebaseConnect()(Example)
Returns Promise Containing reference snapshot
Removes data from Firebase at a given path.
Parameters
path
String Path to location on Firebase which to removeonComplete
Function Function to run on complete (not required
)
Examples
Basic
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'
const Example = ({ firebase: { remove } }) => (
<button onClick={() => remove('some/path')}>
Remove From Firebase
</button>
)
export default firebaseConnect()(Example)
Returns Promise Containing reference snapshot
Sets data to Firebase only if the path does not already exist. Otherwise, it rejects.
Parameters
path
String Path to location on Firebase which to setvalue
(Object | String | Boolean | Number) Value to write to FirebaseonComplete
Function Function to run on complete (not required
)
Examples
Basic
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { firebaseConnect } from 'react-redux-firebase'
const Example = ({ firebase: { uniqueSet } }) => (
<button onClick={() => uniqueSet('some/unique/path', true)}>
Unique Set To Firebase
</button>
)
export default firebaseConnect()(Example)
Returns Promise Containing reference snapshot
Upload a file to Firebase Storage with the option to store its metadata in Firebase Database
Parameters
path
String Path to location on Firebase which to setfile
File File object to upload (usually first element from array output of select-file or a drag/droponDrop
)dbPath
String Database path to place uploaded file metadata
Returns Promise Containing the File object
Upload multiple files to Firebase Storage with the option to store their metadata in Firebase Database
Parameters
path
String Path to location on Firebase which to setfiles
Array Array of File objects to upload (usually from a select-file or a drag/droponDrop
)dbPath
String Database path to place uploaded files metadata.
Returns Promise Containing an array of File objects
Delete a file from Firebase Storage with the option to remove its metadata in Firebase Database
Parameters
path
String Path to location on Firebase which to setdbPath
String Database path to place uploaded file metadata
Returns Promise Containing the File object
Watch event. Note: this method is used internally so examples have not yet been created, and it may not work as expected.
Parameters
type
String Type of watch eventdbPath
String Database path on which to setup watch eventpath
storeAs
String Name of listener results within redux store
Returns Promise
Unset a listener watch event. Note: this method is used internally so examples have not yet been created, and it may not work as expected.
Parameters
eventName
String Type of watch eventeventPath
String Database path on which to setup watch eventstoreAs
String Name of listener results within redux storequeryId
(optional, defaultundefined
)
Returns Promise
Logs user into Firebase. For examples, visit the auth section
Parameters
credentials
Object Credentials for authenticatingcredentials.provider
String External provider (google | facebook | twitter)credentials.type
String Type of external authentication (popup | redirect) (only used with provider)credentials.email
String Credentials for authenticatingcredentials.password
String Credentials for authenticating (only used with email)
Returns Promise Containing user's auth data
Logs user out of Firebase and empties firebase state from redux store
Returns Promise
Creates a new user in Firebase authentication. If
userProfile
config option is set, user profiles will be set to this
location.
Parameters
credentials
Object Credentials for authenticatingprofile
Object Data to include within new user profile
Returns Promise Containing user's auth data
Sends password reset email
Parameters
credentials
Object Credentials for authenticatingcredentials.email
String Credentials for authenticating
Returns Promise
Confirm that a user's password has been reset
Parameters
Returns Promise
Verify that a password reset code from a password reset email is valid
Parameters
code
String Password reset code to verify
Returns Promise Containing user auth info
Firebase ref function
Returns database.Reference Firebase database reference
Firebase auth service instance including all Firebase auth methods
Returns Auth
Firebase database service instance including all Firebase storage methods
Returns Database Firebase database service
Firebase storage service instance including all Firebase storage methods
Returns Storage Firebase storage service
Firebase messaging service instance including all Firebase messaging methods
Returns firebase.messaging Firebase messaging service