React - Js Interview Prep
React - Js Interview Prep
app/
1) What is Reactjs?
React is a JavaScript library that makes building user interfaces easy. It was developed by
Facebook.
Integrating React with the MVC framework like Rails requires complex configuration.
React require the users to have knowledge about the integration of user interface into
MVC framework.
1 / 10
https://ayushdubey.netlify.app/
Facebook widely uses flux architecture concept for developing client-side web applications. It
is not a framework or a library. It is simply a new kind of architecture that complements React
and the concept of Unidirectional Data Flow.
Redux is a library used for front end development. It is a state container for JavaScript
applications which should be used for the applications state management. You can test and run
an application developed with Redux in different environments.
Redux has a feature called 'Store' which allows you to save the application's entire State at one
place. Therefore all it's component's State are stored in the Store so that you will get regular
updates directly from the Store. The single state tree helps you to keep track of changes over
time and debug or inspect the application.
It is a function which returns an action object. The action-type and the action data are always
stored in the action object. Actions can send data between the Store and the software
application. All information retrieved by the Store is produced by the actions.
10) Name the important features of ReactHere, are important features of React.
Stateless components are pure functions that render DOM-based solely on the properties
provided to them.
React Router is a routing library which allows you to add new screen flows to your application,
and it also keeps URL in sync with what’s being shown on the page.
2 / 10
https://ayushdubey.netlify.app/
React Motion
React Transition Group
Jest is a JavaScript unit testing framework created by Facebook based on Jasmine. It offers
automated mock creation and a jsdom environment. It is also used as a testing component.
A dispatcher is a central hub of app where you will receive actions and broadcast payload to
registered callbacks.
A callback function should be called when setState has finished, and the component is
rerendered.
A higher-order component also shortly known as HOC is an advanced technique for reusing
component logic. It is not a part of the React API, but they are a pattern which emerges from
React’s compositional nature.
A presentational part is a segment which allows you to renders HTML. The segment’s capacity
is presentational in markup.
Props mean properties, which is a way of passing data from parent to child. We can say that
props are just a communication channel between components. It is always moving from parent
to child component.
The super keyword helps you to access and call functions on an object’s parent.
The yield catchphrase is utilized to delay and resume a generator work, which is known as yield
catchphrase.
22) Name two types of React componentTwo types of react Components are:
3 / 10
https://ayushdubey.netlify.app/
Function component
Class component
Synthetic event is a kind of object which acts as a cross-browser wrapper around the browser’s
native event. It also helps us to combine the behaviors of various browser into signal API.
It is an object which decides how a specific component renders and how it behaves. The state
stores the information which can be changed over the lifetime of a React component.
The arrow function helps you to predict the behavior of bugs when passed as a callback.
Therefore, it prevents bug caused by this all together.
Initialization
State/Property updates
Destruction are the lifecycle of React
The main difference the two is that the State is mutable and Pros are immutable.
Pure components are the fastest components which can replace any component with only a
render(). It helps you to enhance the simplicity of the code and performance of the application.
There are mainly two sorts of information that control a segment: State and Props
'create-react-app' is a command-line tool which allows you to create one basic react application.
Keys allow you to provide each list element with a stable identity. The keys should be unique.
Children props are used to pass component to other components as properties. You can access
it by using
[crayon-5f30160522ee5038184473/]
34) Explain error boundaries?
Error boundaries help you to catch Javascript error anywhere in the child components. They are
most used to log the error and show a fallback UI.
StrictMode allows you to run checks and warnings for react components. It runs only on
development build. It helps you to highlight the issues without rendering any visible UI.
Portal allows you to render children into a DOM node. CreatePortalmethod is used for it.
React context helps you to pass data using the tree of react components. It helps you to share
data globally between various react components.
Webpack in basically is a module builder. It is mainly runs during the development process.
Babel, is a JavaScript compiler that converts latest JavaScript like ES6, ES7 into plain old ES5
JavaScript that most browsers understand.
If you want the browser to read JSX, then that JSX file should be replaced using a JSX
transformer like Babel and then send back to the browser.
42) What are the major issues of using MVC architecture in React? 5 / 10
https://ayushdubey.netlify.app/
Here are the major challenges you will face while handling MVC architecture:
43) What can be done when there is more than one line of expression?
At that time a multi-line JSX expression is the only option left for you.
It is actually a cross-browser wrapper around the browser’s native event. These events have
interface stopPropagation() and preventDefault().
46) When should you use the top-class elements for the function element?
If your element does a stage or lifetime cycle, we should use top-class elements.
When a component's state or props change then rest will compare the rendered element with
previously rendered DOM and will update the actual DOM if it is needed. This process is known
as reconciliation.
You can’t update props in react js because props are read-only. Moreover, you can not modify
props received from parent to child.
Restructuring is extraction process of array objects. Once the process is completed, you can
separate each object in a separate variable.
'Prop-types' library allows you to perform runtime type checking for props and similar object in a
recent application.
React hooks allows you to use State, and other React features without writing a class.
You can use fragment keyword to group a list of children components without using any extra
nodes to the DOM.
For example :
[crayon-5f30160522eec150238816/]
57) What is the main difference between createElement and cloneElment?
60) List down some of the methods in a react-dom packageImportant methods for react-
render() hydrate()
createPortal()
unmountComponentAtNode()
findDOMNode()
7 / 10
https://ayushdubey.netlify.app/
If you want to create one component by extending 'React. Component’, the constructor helps
you to initialize the State. But, if you want to create by using 'Reat.createClass.’ then you
should use ‘genInitiaState.' 63) What is refs?
Ref are an attribute of the DOM elements. The primary purpose of the refs is to find the DOM
elements easily.
This function is called after the DOM element removes from DOM, and it will swipe the memory,
which helps you to increase the access space.
We can dispatch the data to another component which should be based on the action which
stores the parent component.
66) How will be you able to handle more action using redux?
In order to create the same component in more action flow, we are using the same functionality
in various modules.
We can spill the rescues based on the event actions. That action should be split in separate
modules.
68) Name any five predefined prototypes used in ReactMost important protoype used in
React js are:
number
string
array
object
element
BindActionCreator helps you to bind the event based on the action dispatcher to the HTML
element.
8 / 10
https://ayushdubey.netlify.app/
Ref is a reference to the element. It should be avoided in most cases. However, sometimes it is
used when you need to access DOM or instance of the component directly.
Yes, you can use attach JSX element with other JSX components which is very much similar to
nesting HTML elements.
73) Name out an important feature of Redux workflow featuresImportant features of Redux
workflow are:
React js is a front end open-source JavaScript library used for building UIs.
Rect Native, is an open-source, mobile framework which allows developers to user React on
platforms like Android and iOS.
9 / 10
https://ayushdubey.netlify.app/
10 / 10