Test Yourself: Prerequisites
Test your knowledge of JavaScript and React before you take the lessons in this course.
We'll cover the following...
We'll cover the following...
Choose the correct answer(s).
1.
Which parts of the document get rerendered after the timer updates in the code below?
function tick() {
const element = (
<div>
<h1>Hello, world!</h1>
<h2>Time = {new Date().toLocaleTimeString()}.</h2>
</div>
);
ReactDOM.render(element, document.getElementById('root'));
}
setInterval(tick, 1000);
A.
The whole content
B.
Only the h1
element
C.
Only the h2
element
D.
Nothing
1 / 15