React Native Interview Questions and Answers
Freshers / Beginner level questions & answers
Ques 1. What is React Native?
React Native is a JavaScript framework for building mobile applications using React. It allows developers to use React to build mobile apps for iOS and Android platforms.
Example:
import React from 'react';
import { Text, View } from 'react-native';
const App = () => {
return (
Hello, React Native!
);
};
export default App;
Ques 2. Explain the difference between React and React Native.
React is a JavaScript library for building user interfaces, primarily for web applications, while React Native is a framework for building mobile applications using React for iOS and Android platforms.
Ques 3. What is JSX in React Native?
JSX (JavaScript XML) is a syntax extension for JavaScript used with React Native. It allows developers to write HTML-like code in their JavaScript files.
Example:
Hello, JSX!
Ques 4. What are Props in React Native?
Props (short for properties) are a mechanism to pass data from a parent component to a child component in React Native. They are immutable and used to customize the child component.
Example:
Ques 5. What is the purpose of 'setState' in React Native?
'setState' is used in React Native to update the state of a component. It triggers a re-render of the component and its children with the updated state.
Example:
const handleClick = () => {
setState({ count: count + 1 });
};
Ques 6. What is the purpose of 'StyleSheet' in React Native?
'StyleSheet' is used to define styles in a React Native app. It provides an abstraction that enables better performance by allowing the framework to optimize the styling.
Example:
const styles = StyleSheet.create({
container: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
},
});
Ques 7. What is the purpose of 'Touchable' components in React Native?
Touchable components like TouchableOpacity and TouchableHighlight provide a way to capture touches or clicks on a component. They are used to make elements interactive.
Example:
alert('Button pressed!')}>
Press me
Ques 8. What is the purpose of the 'ActivityIndicator' component in React Native?
The 'ActivityIndicator' component is used to show a loading indicator in a React Native app. It visually indicates that something is happening in the background.
Example:
Most helpful rated by users: