The code snippet given alongside is used to detect which platform the React Native application is running on. Which of the given alternative methods can be used for the same purpose?
clickMe() {
var message = ‘’;
if(Platform.OS == ‘ios’) {
message = ‘Welcome to iOS!’;
} else if(Platform.OS == ‘android’) {
message = ‘Welcome to Android!’;
}
Alert.alert(message);
}
Options
- You can use the select method
- You can use the virtual DOM method
- You can use the render method
- There is no alternative method