React Native interview question · Most asked
How do push notifications work in a React Native app?
Summary
The app asks for permission, obtains a device push token (an Expo push token or native APNs/FCM token), sends it to your server, and the server sends messages through the push service. Taps are handled by reading the notification's data and navigating.
Longer Answer
Ask for permission in context. Store multiple tokens per user and delete tokens reported invalid. Android needs notification channels. Handle three tap cases: app in foreground, in background, and launched from a killed state (read the last notification response at startup). Only navigate to internal routes from notification data.
Key Points
- Permission → token → server → push service.
- Multiple tokens per user; prune invalid ones.
- Route taps from data, including cold start.
Deep dive: Mobile Apps with React Native and Expo: Push Notifications
Explanation
What interviewers look for
End-to-end understanding including the server side and cold-start handling.
More most-asked React Native questions
- What is React Native, and how does it differ from a hybrid (WebView) app?
- Explain the React Native threading model.
- What is the React Native New Architecture?
- When would you use FlatList instead of ScrollView, and how do you make long lists fast?
- Where should you store data on the device, and what should never go in AsyncStorage?
- How would you make a React Native app work offline?
- How do you handle authentication tokens in a mobile app?
- A screen in your React Native app is slow. How do you investigate and fix it?