Dynamic Links
Dynamic Links
Firebase Dynamic Links are smart URLs that work consistently across platforms, directing users to specific content within your app if installed, or to the app store if not yet installed.
Installing Dynamic Links
bash
npm install @react-native-firebase/dynamic-links
Creating a Dynamic Link
javascript
import dynamicLinks from '@react-native-firebase/dynamic-links';
const link = await dynamicLinks().buildShortLink({
link: 'https://myapp.com/products/42',
domainUriPrefix: 'https://myapp.page.link',
android: { packageName: 'com.myapp' },
ios: { bundleId: 'com.myapp' },
});
Handling Links When App Opens
javascript
useEffect(() => {
const unsubscribe = dynamicLinks().onLink((link) => {
handleDynamicLink(link);
});
return unsubscribe;
}, []);
Handling Links from a Quit State
javascript
useEffect(() => {
dynamicLinks().getInitialLink().then((link) => {
if (link) handleDynamicLink(link);
});
}, []);
Parsing Link Data
javascript
function handleDynamicLink(link) {
const url = new URL(link.url);
const productId = url.pathname.split('/').pop();
navigation.navigate('ProductDetails', { id: productId });
}
Common Use Cases
- Referral and invitation links
- Sharing specific content, like a product or article
- Marketing campaign links that route to specific app content
Conclusion
Firebase Dynamic Links provide a reliable, cross-platform way to direct users into specific content within your React Native application, whether they already have the app installed or not.

