React JS Interview Questions and Answers Set 8

71.what are the limitations of react?

Limitations of react are listed below:

  • React is just a library, not a full-blown framework
  • Its library is very large and takes time to understand
  • It can be little difficult for the novice programmers to understand
  • Coding gets complex as it uses inline templating and jsx

72.What is the main goal of react fiber?

The goal of react fiber is to increase its suitability for areas like animation, layout, and gestures. Its headline feature is incremental rendering: the ability to split rendering work into chunks and spread it out over multiple frames.

73.How is react router different from conventional routing?

Conventional routing vs react routing

Topic Conventional routing React routing
Pages involved Each view corresponds to a new file Only single html page is involved
Url changes A http request is sent to a server and corresponding html page is received Only the history attribute is changed
Feel User actually navigates across different pages for each view User is duped thinking he is navigating across different pages

74.What is react fiber?

Fiber is the new reconciliation engine or reimplementation of core algorithm in react v16. The goal of react fiber is to increase its suitability for areas like animation, layout, gestures, ability to pause, abort, or reuse work and assign priority to different types of updates; and new concurrency primitives.

75.  Differentiate between real dom and virtual dom.

Real dom vs virtual dom

Real dom Virtual  dom
1. It updates slow. 1. It updates faster.
2. Can directly update html. 2. Can’t directly update html.
3. Creates a new dom if element updates. 3. Updates the jsx if element updates.
4. Dom manipulation is very expensive. 4. Dom manipulation is very easy.
5. Too much of memory wastage. 5. No memory wastage.

REACT JS & CERTIFICATION
Weekend / Weekday Batch

76.What is the difference between shadow dom and virtual dom?

The shadow dom is a browser technology designed primarily for scoping variables and css in web components. The virtual dom is a concept implemented by libraries in javascript on top of browser apis.

77. What is the life cycle of reactjs?

  • Initialization
  • State/property updates
  • Destruction

78.Explain the concept of a Thunk in Redux.

A Thunk in Redux is a function that returns another function instead of a plain action object. It’s used to perform asynchronous operations and dispatch multiple actions. Thunks allow you to write action creators that return a function instead of an action. This can be useful for performing asynchronous operations, such as API calls, and dispatching multiple actions, such as one to indicate that the API call has started and another to indicate that it has finished. The inner function receives the store’s dispatch method as an argument, which can be used to dispatch actions at any point in the future. Thunks are typically implemented using a middleware, such as the redux-thunk middleware.

79.What is inline conditional expressions?

You can use either if statements or ternary expressions which are available from js to conditionally render expressions. Apart from these approaches, you can also embed any expressions in jsx by wrapping them in curly braces and then followed by js logical operator &&.

<h1>hello!</h1>

{

Messages.length > 0 &&

<h2>

You have {messages.length} unread messages.

</h2>

}

80.why is switch keyword used in react router v4?

Although a <div> is used to encapsulate multiple routes inside the router. The ‘switch’ keyword is used when you want to display only a single route to be rendered amongst the several defined routes. The <switch> tag when in use matches the typed url with the defined routes in sequential order. When the first match is found, it renders the specified route. Thereby bypassing the remaining routes.