React Native Interview Questions

tutorial and example
tutorial and example

1) What is React Native?

React Native is a JavaScript framework used for native mobile application development. It uses native component of React framework instead of using web component.

2) What is “props” and “state”?

“Props” and “state” are used to manage data inside components. Props are immutable component which means props can be changed or update in future. But State data are mutable, it cannot be changed in future also.

3) What is Style?

The style prop is plain JavaScript object use to making style of React Native application. There are two ways to style your element in React Native application.

  • By using style property, which adds styles inline.
  • By using external Stylesheet for styling.

4) How To Handling Multiple Platforms?

React Native smoothly handle multiple platforms. The large numbers of the React Native APIs are cross-platform, so that one React Native component will work seamlessly on both iOS and Android.

5) When would you use a class component over a functional component?

We use class component if our component has state or a lifecycle method(s). Otherwise,we use a Functional component.

6) Differentiate between React Native and ReactJS?

React Native is a JavaScript framework used to develop native mobile application using JavaScript as the development language.

ReactJs is a JavaScript Library used to develop application in HTML5 using JavaScript as the developing language.

7) How React Native handle different screen size?

To handle different screen size React Native offers Flexbox support. Flexbox is designed to provide a consistent layout on different screen sizes. It offers three main properties:

  • flexDirection
  • justifyContent
  • alignItems.

8) Are all React components are usable in React Native?

Web React components use DOM elements to display (ex. div, h1, table, etc) but these are not supported by React Native. We will need to find libraries/components made specifically for React Native.

But today React is focusing on components that can be shared between the web version of React and React Native. This concept has been formalized since React v0.14.

9) What is the challenge with React Native?

Working across separate Android and iOS codebases is challenging.

10) Do React Native use the same code base for Android and iOS?

Yes, React Native uses the same code base for Android and IOS. React take cares of the native components translations.

For example: A React Native ScrollView uses native ScrollView on Android and UiScrollView on iOS.

11) Thus React Native is a native Mobile App?

Yes, React Native compiles a native mobile app using native app components. React Native builds a real mobile app that is indistinguishable from an app built using Objective-C or Java.

12) How React Native load data from server?

React Native provides the Fetch API which deals networking needs. React Native uses componentDidMount lifecycle method to load the data from server.

Other Networking libraries which interact with server are:

13) What is Gesture Responder System?

The gesture responder system manages the lifecycle of gestures in the app.

Users interact with mobile apps mainly through touch. They can use a combination of gestures, such as tapping on a button, zooming on a map, or scrolling a list.

14) How can React Native integrate more features on existing app?

React Native is great to start a new application from scratch. However, React Native works well to add new features to existing native application. It need some steps to add new React Native based features, screen, views, etc. The specific steps are different for different platform you’re targeting.

  • Set up directory structure.
  • Install JavaScript dependencies.
  • Configuring permissions.
  • Code integration.
  • Test your integration.

15) What is the storage system in React Native?

React Native uses AsyncStorage class for store data in key-value pair which is global to all app. AsyncStorage is a JavaScript code which is a simple, unencrypted, asynchronous and persistent. React Native also uses seprate files for iOS and RocksBD or SQLite for Android.