React Native Questions

Warm up for your React Native interview with most asked questions and answers for junior, mid, and senior roles.

Junior

What are refs and why are they useful?

Show Answer

Refs provide a way to access a DOM node or component instance from within a component. In React, you can create a reference using useRef() hook.

Junior

What are some ways to add style to a react native component?

Show Answer
  • Inline styling
  • StyleSheet
  • Styled Components
  • Tailwind
Junior

What are components?

Show Answer

Components are independent and reusable bits of code. They serve the same purpose as JavaScript functions

Junior

What is justifyContent and alignItems in React Native?

Show Answer

justifyContent is used to align the content on the main axis. alignItems is used to align the content on the cross axis.

 

When flexDirection: "row", Main Axis is left to right

When flexDirection: "column", Main Axis is top to bottom

Junior

When should you use Flatlist or ScrollView?

Show Answer

Use Flatlist when:

  • A big list of similar items
  • A list of items that you don't know the length

 

Use Scrollview when:

  • A small list of items
  • Generic items in a scrollable area
Junior

What is JSX?

Show Answer

JSX is an HTML like syntax used by React and React Native that allows you to write HTML inside of JavaScript.

Junior

What are props in React Native?

Show Answer

Props can be simply the component properties or pieces of data that are passed to the component.

Junior

What are native apps?

Show Answer
  • A native app is an app that is developed for use on a specific platform.
  • For example Swift and Objective-C for native iOS apps and Java and Kotling for Android native apps.
Junior

What is React Native

Show Answer

React Native is an open-source mobile application framework created by Facebook.

 

It is used to develop applications for Android, iOS, Web, and UWP by enabling developers to use React and native platform capabilities.

Junior

What are some benefits of using React Native?

Show Answer
  • Code Reusability and Cross-platform compatibility
  • Native Look and Feel
  • Large Community Support
  • Live/ Hot Reloading
  • Great Performance 
  • Open-source framework
Junior

What are some ways to persist data in React Native?

Show Answer
  • Async Storage
  • SQLite
  • Realm DB
  • Watermelon DB
  • MMKV
Junior

Explain some of the tradeoffs between building a React Native and building a “true” native app.

Show Answer

If you are building an app that depends a lot on native libraries, you may want to consider building a Native app, because native provides superior performance and gives developers complete access to the capabilities of each device. But you will have two codebases for your app, one for Android and one for iOS.

 

On the other hand, if your application does not depends a lot on native libraries, you may want to build a React Native app, because it is easier to maintain and it is easier to test.

Junior

What is the difference between React Native and ReactJS?

Show Answer
  • ReactJS main focus is Web Development
  • ReactJS is a Javascript library
  • React uses HTML tags like p,span,div, etc...
  • React Native is focused on Mobile Development
  • React Native is a mobile framework that uses Javascript Engine
  • Both are open-source and supports the JSX syntax
Junior

What is State in React Native?

Show Answer

State is a mutable data structure that is used to contain data about a component. A component's state can change over time; whenever it changes, the component re-renders