What is linking in React Native?
Why Interviewers Ask This
This question tests conceptual clarity. Interviewers want to hear a precise, confident definition before moving to more complex React Native topics. It also reveals how well you can explain technical ideas to non-experts.
Answer
The Linking API allows React Native apps to interact with the outside world — opening URLs (web, email, phone, maps), handling deep links into your own app, and opening the device settings. Opening URLs: import { Linking } from "react-native"; // Open a webpage: await Linking.openURL("https://reactnative.dev"); // Make a phone call: await Linking.openURL("tel:+1234567890"); // Send an email: await Linking.openURL("mailto:support@example.com?subject=Help"); // Open maps: await Linking.openURL("https://maps.google.com/?q=New+York"); // Open app settings: await Linking.openSettings(); // Check if URL can be opened: const canOpen = await Linking.canOpenURL("fb://profile/123"); if (canOpen) { await Linking.openURL("fb://profile/123"); } else { await Linking.openURL("https://facebook.com/123"); }. Deep linking (handling incoming URLs): configure the app to respond to custom URL schemes (myapp://screen/id) or Universal Links (iOS) / App Links (Android) (https://myapp.com/screen/id): useEffect(() => { // Handle initial URL (app was closed): Linking.getInitialURL().then(url => { if (url) handleDeepLink(url); }); // Handle URL while app is open: const subscription = Linking.addEventListener("url", ({ url }) => { handleDeepLink(url); }); return () => subscription.remove(); }, []);. React Navigation handles deep linking automatically with linking config prop on NavigationContainer.
Pro Tip
Demonstrate both theoretical understanding and practical experience. Say what it is, then give an example of how you actually used it in a React Native codebase.