0
0
React Nativemobile~20 mins

Deep linking basics in React Native - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Deep Linking Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
ui_behavior
intermediate
2:00remaining
What happens when a deep link is opened?
In a React Native app configured for deep linking, what is the expected behavior when a user opens a deep link URL that matches a registered route?
AThe app navigates directly to the screen associated with the deep link route.
BThe app restarts and shows the home screen regardless of the deep link.
CThe app crashes because deep linking is not supported by default.
DThe app opens the device browser instead of the app.
Attempts:
2 left
💡 Hint
Think about what deep linking is designed to do in navigation.
🧠 Conceptual
intermediate
2:00remaining
Purpose of URL schemes in deep linking
Why do React Native apps use custom URL schemes or universal links for deep linking?
ATo disable navigation within the app.
BTo improve app performance by caching screens.
CTo prevent users from opening the app accidentally.
DTo allow the app to be opened from external sources using specific URLs.
Attempts:
2 left
💡 Hint
Consider how apps can be launched from outside themselves.
📝 Syntax
advanced
2:00remaining
Correct deep linking config in React Navigation
Which option shows the correct way to configure deep linking in React Navigation for a screen named 'Profile' with path 'user/:id'?
Aconst linking = { prefixes: ['myapp://'], config: { screens: { Profile: { path: 'user/:id' } } } };
Bconst linking = { prefixes: ['myapp://'], config: { screens: { 'user/:id': 'Profile' } } };
Cconst linking = { prefixes: ['myapp://'], config: { Profile: 'user/:id' } };
Dconst linking = { prefixes: ['myapp://'], config: { screens: { Profile: 'user/:id' } } };
Attempts:
2 left
💡 Hint
Look for the correct nested object structure for screen paths.
lifecycle
advanced
2:00remaining
Handling deep link when app is already open
What is the recommended way to handle a deep link URL when the React Native app is already running in the background?
AForce close the app and reopen it with the new URL.
BUse an event listener to detect URL changes and navigate accordingly.
CIgnore the deep link because the app is already open.
DRestart the app to process the new deep link.
Attempts:
2 left
💡 Hint
Think about how apps listen for new data while running.
🔧 Debug
expert
2:00remaining
Why does this deep link not open the correct screen?
Given this linking config snippet, why does opening 'myapp://profile/123' not navigate to the Profile screen? const linking = { prefixes: ['myapp://'], config: { screens: { Profile: 'user/:id' } } };
AThe linking config must be inside the NavigationContainer component.
BThe prefixes array is missing the 'https://' prefix.
CThe path 'user/:id' does not match the URL segment 'profile/123'.
DThe config object is missing a 'path' key inside Profile.
Attempts:
2 left
💡 Hint
Check if the URL path matches the configured path exactly.