React Technical Interview Questions

Can you list an example of each?Both libraries and frameworks are reusable code written by someone.

The technical difference between framework and library lies in a term called inversion of control.

When you use a library, you are in charge of the flow of the application.

You are choosing when and where to call the library.

When you use a framework, the framework is in charge of the flow.

It provides some places for you to plug in your code, but it calls the code you plugged in as needed.

The framework inverts the control of the program.

It tells the developer what they need.

A Library does not.

The programmer calls the library where and when they need it.

Libraries: jQuery, React, BootstrapFrameworks: Angular, Vue, Rails2-What does it mean when we say a programming library or language is declarative?.How can we tell React components are declarative?Declarative programming is when you write your code in such a way that describes what you want to do, and not how you want to do it.

It is left to the compiler to figure out how.

Difference between declarative/imperative programming:A declarative style, like what React has, allows you to control flow and state in your application by saying “It should look like this”.

An imperative style turns that around and allows you to control your application by saying “This is what you should do”.

The benefits of declarative are that you don’t get bogged down in the implementation details of representing the state.

Being able to describe the state reduces the surface area for bugs dramatically, which is a benefit.

On the other hand, you might have less flexibility on how things occur because you are delegating or abstracting away how you implement state.

3-What is the benefit of using JSX?.Make a case for (or against) this technology.

JSX is just an HTML-like syntax, it’s optional, and its purpose is to simplify the creation of React tree module nodes with attributes.

It lets you create JavaScript objects with HTML syntax.

While not mandatory, developers report that JSX makes developing in React much easier.

Nearly all React applications use JSX syntax.

4-Describe what Webpack does in a projectWebpack is a module bundler for javascript applications.

Webpack recursively builds every module in your application, then packs all those modules into a small number of bundles.

In addition to the general benefits listed above, Webpack offers a few of its own helpful features:Flexible Configurations: Webpack supports things called plugins and loaders that can further configure it to work with other tools.

We’ll learn more about them in a moment.

Development Server: It also offers a development server that can be configured to re-bundle code every time it changes.

This is called hot reloading or hot module replacement.

(We’ll work on this in an upcoming lesson.

)5-What are keys in React, and why are they important?A “key” is a special string attribute you need to include when creating lists of elements.

Keys help React identify which items have changed, are added, or are removed.

Keys should be given to the elements inside the array to give the elements a stable identity.

The best way to pick a key is to use a string that uniquely identifies a list item among its siblings.

Most often you would use IDs from your data as keys.

When you don’t have stable IDs for rendered items, you may use the item index as a key as a last resort.

6-Describe React’s reconciliation process used to update the DOM.

Reconciliation is the process through which React updates the DOM.

When a component’s state changes, React has to calculate if it is necessary to update the DOM.

It does this by creating a virtual DOM and comparing it with the current DOM.

In this context, the virtual DOM will contain the new state of the component.

Good Luck!!!.

. More details

Leave a Reply