100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Mern stack question and answers_ node_react_express $10.59   Add to cart

Class notes

Mern stack question and answers_ node_react_express

 3 views  0 purchase
  • Course
  • Institution

I have written the detailed notes which includes the all the possible question for the course with the detailed answers. the course name is web technologies and the title of the topic is Mern stack. In the notes, I have tried my best to cover all the topics including JavaScript, react, express an...

[Show more]

Preview 4 out of 32  pages

  • February 9, 2023
  • 32
  • 2022/2023
  • Class notes
  • Usman
  • All classes
avatar-seller
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.


3. What are the features of React?
Major features of React are listed below:
i. It uses the virtual DOM instead of the real DOM.
ii. It uses server-side rendering.
iii. It follows uni-directional data flow or data binding.


4. List some of the major advantages of React.
Some of the major advantages of React are:
i. It increases the application’s performance
ii. It can be conveniently used on the client as well as server side
iii. Because of JSX, code’s readability increases
iv. React is easy to integrate with other frameworks like Meteor, Angular, etc
v. Using React, writing UI test cases become extremely easy
5. What are the limitations of React?
Limitations of React are listed below:
i. React is just a library, not a full-blown framework
ii. Its library is very large and takes time to understand
iii. It can be little difficult for the novice programmers to understand
iv. Coding gets complex as it uses inline templating and JSX




6. What is JSX?
JSX is a shorthand for JavaScript XML. This is a type of file used by React which
utilizes the expressiveness of JavaScript along with HTML like template syntax. This
makes the HTML file really easy to understand. This file makes applications robust and
boosts its performance. Below is an example of JSX:
1 render(){
return(
2

, 3
4 <div>
5
6 <h1> Hello World from Edureka!!</h1>
7
8 </div>
9
10 );
}
11
7. What do you understand by Virtual DOM? Explain its working.
A virtual DOM is a lightweight JavaScript object which originally is just the copy of the
real DOM. It is a node tree that lists the elements, their attributes and content as
Objects and their properties. React’s render function creates a node tree out of the
React components. It then updates this tree in response to the mutations in the data
model which is caused by various actions done by the user or by the system.
This Virtual DOM works in three simple steps.
1. Whenever any underlying data changes, the entire UI is re-rendered in Virtual
DOM representation.




2. Then the difference between the previous DOM representation and the new one




is calculated.

, 3. Once the calculations are done, the real DOM will be updated with only the




things that have actually changed.
8. Why can’t browsers read JSX?
Browsers can only read JavaScript objects but JSX in not a regular JavaScript object.
Thus to enable a browser to read JSX, first, we need to transform JSX file into a
JavaScript object using JSX transformers like Babel and then pass it to the browser.




12. Explain the purpose of render() in React.
Each React component must have a render() mandatorily. It returns a single React
element which is the representation of the native DOM component. If more than one
HTML element needs to be rendered, then they must be grouped together inside one
enclosing tag such as <form>, <group>,<div> etc. This function must be kept pure i.e.,
it must return the same result each time it is invoked.
13. How can you embed two or more components into one?
We can embed components into one in the following way:
1 class MyComponent extends React.Component{

2 render(){

, 3
return(
4

5
<div>
6

7
<h1>Hello</h1>
8

9
<Header/>
10
</div>
11

12 );
13 }
14 }

15 class Header extends React.Component{

16 render(){

return
17

18
<h1>Header Component</h1>
19

20
};
21
}
22
ReactDOM.render(
23
<MyComponent/>, document.getElementById('content')
24 );
25

14. What is Props?
Props is the shorthand for Properties in React. They are read-only components which
must be kept pure i.e. immutable. They are always passed down from the parent to the
child components throughout the application. A child component can never send a prop
back to the parent component. This help in maintaining the unidirectional data flow and
are generally used to render the dynamically generated data.
15. What is a state in React and how is it used?

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card or Stuvia-credit for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller muhammadshoaib3. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for $10.59. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

78291 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy study notes for 14 years now

Start selling
$10.59
  • (0)
  Add to cart