Complete the code to import the React Native Linking module.
import { [1] } from 'react-native';
The Linking module is used in React Native to handle deep links.
Complete the code to add a listener for incoming deep links.
Linking.addEventListener('[1]', handleDeepLink);
The event name for listening to deep link changes is 'url'.
Fix the error in this code to get the initial URL when the app starts.
const initialUrl = await Linking.[1]();The correct method to get the URL that opened the app is getInitialURL().
Fill both blanks to parse the path from the URL string.
const url = 'myapp://home/profile'; const path = url.[1]('://')[1].[2]('/');
First, split('://') divides the URL into scheme and path parts. Then, split('/') breaks the path into segments.
Fill all three blanks to handle a deep link event and extract the URL.
function handleDeepLink(event) {
const url = event.[1];
const route = url.[2]('://')[1].[3]('/')[0];
console.log('Navigating to:', route);
}The event object has a url property. We use split('://') to separate scheme and path, then split('/') to get the first path segment.