The Firebase JS SDK is now in BETA!
This EAP site is no longer maintained. See the official Firebase Documentation site for the latest documentation and information about the Firebase JS SDK.

Home > @firebase/database > ref

ref() function

Returns a Reference representing the location in the Database corresponding to the provided path. If no path is provided, the Reference will point to the root of the Database.

Signature:

export declare function ref(db: FirebaseDatabase, path?: string): Reference;

Parameters

Parameter Type Description
db FirebaseDatabase The database instance to obtain a reference for.
path string Optional path representing the location the returned Reference will point. If not provided, the returned Reference will point to the root of the Database.

Returns:

Reference

If a path is provided, a Reference pointing to the provided path. Otherwise, a Reference pointing to the root of the Database.