This document introduces React, describing it as a JavaScript library for building user interfaces by rendering components rather than mutating the DOM directly. It discusses how React uses a virtual DOM for fast re-rendering, building components instead of templates, and the use of JSX syntax to write HTML-like code. Components have state and props, and the whole app re-renders when state changes to guarantee updates.
Overview of React by Jai Santhosh, presenting it as a unique library focused on building user interfaces, highlighting its role as the 'V' in MVC.
Emphasis on building components instead of templates, showcasing the importance of re-rendering, the fast Virtual DOM, and transforming data into UI components.
Introduction to JSX, explaining its ability to combine JavaScript and XML, and providing a simple React.DOM example.
Discussion on component state and props, presenting them as immutable, guaranteeing data updates, and illustrating the concept of re-rendering.
Details on the Fast Virtual DOM, explaining how it builds a new subtree, diffs with the old one, and executes minimal DOM mutations for performance.
Links for additional information on React and JavaScript frameworks for deeper understanding and engagement.
Thank you slide marking the end of the presentation.
Build components, nottemplates
• Combine DOM generation and display logic.
• Transform data into interface components.
10
11.
Build components, nottemplates
• Combine DOM generation and display logic.
• Transform data into interface components.
• Data can come from anywhere.
11
Fast Virtual DOM
Onevery update…
• React builds a new virtual DOM subtree
25
26.
Fast Virtual DOM
Onevery update…
• React builds a new virtual DOM subtree
• …diffs it with the old one
26
27.
Fast Virtual DOM
Onevery update…
• React builds a new virtual DOM subtree
• …diffs it with the old one
• …computes the minimal set of DOM
mutations and puts them in a queue
27
28.
Fast Virtual DOM
Onevery update…
• React builds a new virtual DOM subtree
• …diffs it with the old one
• …computes the minimal set of DOM
mutations and puts them in a queue
• …and batch exexutes all updates
28
29.
Fast Virtual DOM
noneto first
• Create Node:
<div
className="first"><span>A Span</span></div>
first to second
• Replace attribute:
className=“second"
className=“first" by
• Replace node:
Span</span> by <p>A Paragraph</p>
<span>A
second to none
• Remove Node:
<div
className="second"><p>A Paragraph</p></div>
29