Interview Questions.

React Native and Redux Interview Questions and Answers


React Native and Redux Interview Questions and Answers

React Native

Q1. What is React Native?  

Ans: React Native is the following era of React - a Javascript code library developed through Facebook and Instagram, which become launched on Github in 2013. Native app creation approach writing apps for a particular working gadget.

React Native facilitates developers reuse code throughout the net and on mobile. Engineers might not should construct the identical app for iOS and for Android from scratch - reusing the code throughout each working machine.

Android and iOS have very one of a kind codebases and startups and organizations frequently war to lease - or have enough money- engineers for each. Now simply one developer can write across specific mobile working systems.

Facebook unfolded React in 2013 and has been the usage of its proprietary React Native code for iOS app improvement for over a year.

Q2. Why open supply?  

Ans: "If we work together within the open, we will strengthen the state of generation together," Facebook said in a blog publish the day past nighttime.

Altruism aside, opting to open source code is a tricky choice. Keeping a companies infrastructure under-wraps has commercial blessings, mainly when your technology is your enterprise version.

But the developer community is unswerving to folks who open up. Web engineers the world over are short to point out a malicious program inside the code for free.

Developing open supply initiatives allows hold Facebook one of the most coveted corporations to paintings for. Developers need a project, and a sense of giving back - and Facebook wishes a big pool of talented engineers to pick its employees from.

Plus, it saves on schooling. If every engineer Facebook hires already is aware of the way to write in React Native, they've a walking start.

Facebook has a tradition of maturing its improvement. Over ten years' it has scaled to serve one thousand million customers, lots of developers and 3 essential structures - iOS, Android and Web.

It's a sizeable improvement from whilst the fledgling startup copied Facebook code on Harvard University's server for releases and,

"poke on it to peer if it turned into nevertheless running each day at 10am," cell engineering manager Bryan O'Sullivan joked earlier this 12 months.

Q3. How did Facebook write React Native for Android?  

Ans: The first move-platform React Native app - ads supervisor - changed into evolved by the London-based dev group, who were inside the US to announce the Android launch the day past night. Ads manager we could companies that market it at the social network control their accounts and create new ads.

React Native has only currently been established in production and building a brand new app based totally at the framework carried a few risk.

Three product engineers acquainted with React set approximately to create an app for Android and predicted troubles with the good judgment important to understand differing time zones, date formats, currencies and ad codecs the world over.

This enterprise common sense turned into already written in JavaScript, and the group knew it would not be efficient to construct it all again in Objective-C to do it once more in Java for Android.

Now this undertaking has been released on Github, builders can use a single workflow to increase for iOS and Android. This way you may use the equal editor and propagate it to both the iOS simulator and Android emulator at the identical time.

Airbnb, Box, Facebook, GitHub, Google, Instagram, LinkedIn, Microsoft, Pinterest, Pixar Animation Studios, Twitter, Uber, and WhatsApp all use React code.

Q4. What's the Challenges with React Native?

Ans: Working across separate iOS and Android codebases is hard.

"When we have been constructing the app, Facebook used this version, and all our construct automation and developer processes have been set up round it. However, it does not work well for a product that, for the maximum part, has a single shared JavaScript codebase," wrote Daniel Witte and Philipp von Weitershausen, engineers at Facebook in a weblog the day past.

Developers who often war to discern out in which the grasp code exists and whether bugs were constant in all systems may additionally want to maintain out for when Facebook opens up its unified repository. It is moving all of its code from Git to Mercurial, and might be one of the biggest codebases of its type.

Google is every other internet massive that is familiar with the energy of open supply, recently committing to OpenStack and developing an enitrely open source container control assignment, Kubernetes. The venture seems at odds with its very own Google cloud commercial enterprise, however again, it knows that the benefits outweigh any loss of Google cloud customers.

HubSpot Video

Q5. Advantages of React Native?  

Ans: The reality that React Native sincerely renders using its host platform's widespread rendering APIs allows it to face out frommost present strategies of cross-platform utility developement ,like Cordova or Ionic. Existing strategies of writing mobile applications using combinations of JavaScript,HTML,and CSS commonly render using webviews.While this method can work, it additionally comes with drawbacks,particularly around overall performance.

Additionally,they do not usually have get right of entry to to the host platform's set of local UI factors.When those body works do try to mimic native UI elements,the consequences commonly "sense" just a little off; opposite-engineering all of the fine details of factors like animations takes an huge amount of effort,and they can quick end up out of date.

In contrast, Reactive Native actually translates your markup to actual,native UI elements,leveraging existing approach of rendering views of whatever platform you are operating with. Additionally,React works one after the other from the primary UI thread,so your software can keep high overall performance without sacrificing functionality.The update cycle in React Native is similar to in React :when props or kingdom exchange,React Native re-renders the perspectives.The major differnce between React Native and React inside the browser is that React Native does this by means of leveraging the UI libraries of its host platform, instead of the use of HTML and CSS markup.

For builders conversant in running at the Web with React,this indicates you could write cell apps with overall performance and look and experience of anative utility,even as the use of familiar tools. React Native additionally represents an improvement over ordinary cellular improvement in two different regions:the developer enjoy and pass-platform improvement capability.

Q6. Handling Multiple Platforms?  

Ans: React Native gracefully handles more than one structures. The vast majority of the React Native APIs are move-platform, so you simply want to jot down one React Native component, and it'll work seamlessly on each iOS and Android. Facebook claims that their Ad Manager utility has 87% code reuse throughout the two systems, and I wrote a flashcard app with none platform-precise code in any respect.

If you do want to put in writing platform-particular code -- due to distinct interplay guidelines on iOS and Android, as an example, or because you want to take benefit of a platform-particular API -- this is clean, too. React Native permits you to specify platform-precise variations of each component, which you may then combine into the rest of your React Native software.

Q7. React Native - Differences between Android and IOS?  

Ans: The base setup for constructing with Android and iOS are the equal, but when you begin entering into the improvement of your app, there are some variations. From what I've experienced, we will probably wager on the usage of about 80% of our code cross platform. I've heard of others using as much as ninety%, and I've normally heard the quantity being round eighty five%.

To use the code cross platform, you would just reproduction the code from your .Ios.Js or .Android.Js report, and replica it into the alternative. As lengthy as there aren't platform particular components, it have to work.


There are some modules that have been construct particularly for iOS, and there are some that have been mainly constructed for Android, and a number of them work go platform. For instance, ActivityIndicatorIOS (https//fb.Github.Io/react-local/medical doctors/activityindicatorios.Html#content) is an iOS styled element, however in case you look in the aspect itself, you will see both ActivityIndicatorIOS.Android.Js and ActivityIndicatorIOS.Ios.Js, so it need to at the least paintings cross platform, however UI will in all likelihood no longer be what you will be seeking out in Android.

If you install any plugins that need to access any local capability, for instance using a custom font, you'll want to do a piece of work one at a time (on every platform) to get them operating for each platform and it'll no longer paintings cross platform.

Bridging can be totally special for each platform, though this will not be some thing you will even must fear approximately until you had to do something that React Native does no longer aid out of the container. To construct in IOS, you may want a Mac and Xcode. To build in Android, you will need the android SDK and a few sort of emulator (I use Genymotion). But remember the fact that as of now, you cannot develop iOS on a Windows system except you use some thing like ExponentJS, however if you have a Mac, you may increase pass platform.

Q8. Are all React components usable in React Native?  

Ans: Web React components use DOM elements to display (ex. Div, h1, desk, and so forth) but those aren't supported with the aid of React Native. You'll want to locate libraries/additives made specifically for React Native.

I doubt there are additives that supports both, as a consequence it ought to be pretty smooth to determine out if it is made for React Native or not. As of now, if the writer does now not particularly say that they made for React Native, it probably does no longer paintings on React Native.

Q9. Passing functions between components in React and React Native?  

Ans: I might live away from such passing capabilities among components. I continually use Flux structure with ReactJs and React Native.

Keep additives just to render stuff by means of properties and sending new actions.

You have tough dependency between additives. This stuff does not scale. It might be difficult to maintaine such code.

What i personally do is simply write movements, stores, dispatcher and don't use any dependency on stuff like redux, due to the fact React Native is envolving unexpectedly and also you by no means know if your dependencies will do it at identical pace.

Q10. Difference among React Native and NativeScript, which one do you opt for and why?  

Ans: React JS for the net is exquisite. But in relation to React Native - i felt i used to be boxed or caged to Reacts way of creating the views and building the display there after.

With NativeScript it is not the case. The UI definition follows XML syntax. I recognise XML so smooth to observe. When it involves software good judgment - it permits ES5, TypeScript - once more which i already recognize so i'm able to reuse my skill. You use a subset of CSS to fashion your app. Again large plus factor here - if you know CSS3, NS lets in you to use most of the simple rule sets to fashion your app. Basically NS is all approximately open requirements - you don't should learn whatever new. You use what you all geared up recognize.

Q11. Are there any dangers to the usage of React Native for cellular development?  

Ans: Having played around with it for a few weeks, I've determined React Native to be fairly buggy. I don't assume it is everywhere near production ready. A lot of functions are currently nonetheless missing, for example, pin annotations for maps. Being that it is open supply, there's nothing stopping you from building the function yourself, however if you're seeking to get something created fast / for production, you're higher off using growing directly for iOS or Android.

Q12. What is the difference between the use of constructor vs getInitialState in React / React Native?  

Ans: The  methods are not interchangeable. You have to initialize country inside the constructor when the use of ES6 instructions, and define the getInitialState technique while using React.CreateClass.

Magnificence MyComponent extends React.Component 



this.Kingdom =  /* initial country */ ;


is equal to

var MyComponent = React.CreateClass(


return  /* initial country */ ;



Q13. Re-Render on Changes?  

Ans: In addition to props, components also can have an inner nation. The most distinguished example of that behavior would be a click counter that updates its value while a button is pressed. The number of clicks itself might be saved in the kingdom.

Each of the prop and kingdom trade triggers a entire re-render of the issue.

Q14. What is a prop?  

Ans: A accurate analogy to outline "what is a prop?" has been likened to the real lifestyles state of affairs of while someone moves from one home to some other. A moving van pulls up and all the contents of the house are loaded within the van and it drives off to be unloaded into the new residence. The residence is the surroundings. The scenery consists of the real walls, flooring, ceilings, doorways- the structure of the residence. This does now not circulate. It is desk bound and permanent. The items boxed up, covered in pads, and carried out to the shifting van while a person is changing residences would all be considered the props.

Q15. What is the difference between the usage of constructor vs getInitialState in React / React Native?  

Ans: The  tactics are not interchangeable. You should initialize nation inside the constructor whilst the usage of ES6 classes, and define the getInitialState technique whilst the use of React.CreateClass.

Elegance MyComponent extends React.Component 



this.Country =  /* initial state */ ;


is equal to

var MyComponent = React.CreateClass(


return  /* initial nation */ ;




Q1. What is the idea of “single source of tWhat is the idea of “unmarried source of fact” in Redux?

Ans: The nation of your whole application is stored in an object tree inside a unmarried save. This makes it smooth to create generic apps, because the kingdom from the server can be serialized and hybridized into the purchaser and not using a more coding attempt. A unmarried kingdom tree additionally makes it less difficult to debug or introspect an utility; it also permits persisting the app's kingdom in development, for a faster improvement cycle.

Q2. How is it unique from MVC and Flux? 

Ans: In classical widely known MVC structure, there is a clear separation between records (version), presentation (view) and logic (controller). There is one difficulty with this, especially in huge-scale packages: The go with the flow of statistics is bidirectional. This way that one alternate (a person input or API response) can affect the country of an software in lots of locations within the code — as an instance, -manner records binding. That may be difficult to keep and debug.

Flux may be very much like Redux. The foremost difference is that Flux has a couple of shops that alternate the country of the utility, and it announces those adjustments as activities. Components can enroll in these activities to sync with the modern-day country. Redux doesn’t have a dispatcher, which in Flux is used to broadcast payloads to registered callbacks. Another distinction in Flux is that many sorts are available, and that creates some confusion and inconsistency.

Q3. What are “moves” in Redux? 

Ans: In a nutshell, actions are activities. Actions ship statistics from the utility (user interactions, internal occasions together with API calls, and form submissions) to the shop. The store gets information only from actions. Internal movements are simple JavaScript gadgets that have a kind belongings (generally constant), describing the sort of motion and payload of data being despatched to the shop.


payload: username: 'alex', password: '123456'


Actions are created with action creators. That sounds obvious, I know. They are just capabilities that return movements.Feature authUser(form)





payload: shape


Calling actions everywhere inside the app, then, is very clean. Use the dispatch technique, like so:dispatch(authUser(shape));

Q4. What is the position of reducers in Redux? 

Ans: In Redux, reducers are capabilities (pure) that take the cutting-edge nation of the software and an movement and then return a brand new country. Understanding how reducers paintings is essential due to the fact they perform maximum of the paintings. Here is a completely easy reducer that takes the cutting-edge nation and an motion as arguments after which returns the following state:feature handleAuth(nation, action)


go back _.Assign(, country,


auth: motion.Payload



For greater complex apps, the usage of the combineReducers() application supplied by using Redux is viable (indeed, encouraged). It combines all the reducers in the app right into a unmarried index reducer. Every reducer is responsible for its own part of the app's state, and the nation parameter is exclusive for each reducer. The combineReducers() application makes the record shape plenty less complicated to keep.

If an item (country) changes only a few values, Redux creates a new item, the values that didn’t exchange will refer to the antique item and only new values will be created. That's incredible for overall performance. To make it even more efficient you can upload Immutable.Js.Const rootReducer = combineReducers(

handleAuth: handleAuth,

editProfile: editProfile,

changePassword: changePassword


Q5. What is ‘Store’ in Redux?

Ans: Store is the item that holds the software nation and affords a few helper techniques to get admission to the nation, dispatch moves and check in listeners. The whole kingdom is represented by a unmarried save. Any action returns a new country through reducers. That makes Redux very simple and predictable.Import  createStore  from ‘redux’;

allow keep = createStore(rootReducer);

let authInfo = username: ‘alex’, password: ‘123456’;


Q6. How is state changed in Redux?

Ans: The only manner to exchange the country is to emit an action, an object describing what befell. This guarantees that neither the views nor the community callbacks will ever write at once to the kingdom. Instead, they explicit an reason to transform the state. Because all modifications are centralized and appear one at a time in a strict order, there are no subtle race situations to look at out for. As movements are just undeniable gadgets, they can be logged, serialized, stored, and later replayed for debugging or checking out functions.Pened. This guarantees that neither the views nor the network callbacks will ever write without delay to the country. Instead, they express an cause to convert the country. Because all modifications are centralized and happen one by one in a strict order, there are not any subtle race conditions to observe out for. As moves are simply undeniable items, they may be logged, serialized, saved, and later replayed for debugging or checking out functions.