0
0
Reactframework~5 mins

Rendering elements in React - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of rendering elements in React?
Rendering elements means showing React components or HTML on the screen so users can see and interact with them.
Click to reveal answer
beginner
How do you render a simple element in React?
You use ReactDOM.createRoot to select a place in the HTML, then call root.render() with a React element like

Hello

.
Click to reveal answer
beginner
What does ReactDOM.createRoot(document.getElementById('root')).render(<App />) do?
It finds the HTML element with id 'root' and shows the <App /> component inside it on the page.
Click to reveal answer
intermediate
Can React render multiple elements at once?
React renders one root element at a time, but that element can contain many nested elements inside it.
Click to reveal answer
intermediate
Why should React elements be immutable?
React elements are like snapshots of the UI. They don’t change after creation, which helps React update the screen efficiently.
Click to reveal answer
Which method is used to render a React element into the DOM?
Aroot.render()
BReact.renderElement()
Cdocument.render()
DReactDOM.show()
What does React render on the screen?
AHTML elements and components
BOnly plain text
CJavaScript functions
DCSS styles
Where do you usually render your React app in the HTML file?
AInside the <head> tag
BInside a div with id 'root'
CInside a <footer> tag
DDirectly in the body without a container
Can you render multiple root elements directly in React?
AOnly if you use class components
BYes, React renders as many roots as you want
CNo, React renders one root element at a time
DOnly if you use ReactDOM.renderMultiple()
Why are React elements considered immutable?
ABecause they change automatically
BBecause they are functions
CBecause they are stored in a database
DBecause they represent a fixed UI snapshot
Explain how React renders elements to the screen starting from the HTML file.
Think about how React connects JavaScript code to the HTML page.
You got /4 concepts.
    Describe why React elements are immutable and how this helps React update the UI.
    Consider how React knows what parts of the screen to update.
    You got /4 concepts.