Rendering Elements Flashcards
What is the smallest building block of a React app?
Element
Unlike browser DOM elements, React elements are plain ______?
Objects! They are cheap to create and React DOM takes care of updating the DOM to match the React elements.
What is the name of the DOM node where everything inside it will be managed by React DOM?
Root.
Can you have more than one root DOM node?
Applications built with just React usually have a single root DOM node.
However, ff you are integrating React into an existing app, you may have as many isolated root DOM nodes as you like.
What is the ReactDOM
method used to render an element to the page?
ReactDOM.render()
True/False? React elements are immutable
True. Once you create an element, you can’t change its children or attributes. An element is like a single frame in a movie: it represents the UI at a certain point in time.
Given the following example, when setInterval fires, what will be updated?
Only the time! React DOM compares the element and its children to the previous one, and only applies the DOM updates necessary to bring the DOM to the desired state.