ReactJS Cert
What are the benefits of using components?
- Each piece of UI is simple and easy to develop - One piece can be reused in other places - It is easy to modify one piece of the UI without having to touch the whole website
How does the Virtual DOM work?
- The initial virtual DOM is an exact representation of the actual DOM - When anything needs to be changed it does not compare with the actual DOM. Instead it compares which parts of the Virtual DOM needs changes. This makes it faster - Instead of re-painting or re-positioning for every change, it creates a collection or batch of changes in the Virtual DOM - It repaints only those areas in which the DOM has been changed
Why use React?
- its simplicity and ease of use - supports re-usability of components - is a SPA - React gives us the best performance in manipulating the DOM
Key Features of React?
- lightweight and easy to use - high performance DOM manipulation - data passed around is immutable - flexibility to use other libraries - manages the state of the UI and updates only specific portions of the DOM
What are the 2 main things React caters to?
1) Rendering elements on the page efficiently 2) Handling events
What is the id for the div tag that renders our Index.js
<div id="root></div>
What is JSX?
JSX is a special syntax introduced in ReactJS to write presentation code (JSX is converted to JS, as the browser does not understand JSX using a JS compiler called Babel)
Does the Virtual DOM exist in the browser?
No
What is ReactJS
ReactJS is a javascript library used for building user interfaces in web and mobile apps
T/F: The Virtual DOM in React actually updates only specific portions of the DOM?
True
What is <React.Fragment></React.Fragment> used for?
Used instead of wrapping multiple elements inside of an unnecessary div tag in rendering JSX elements (best practice)