Easy
What is the outcome of executing the following React code (using Hooks)?
import React, { useState, useEffect } from 'react';
function Example() {
const [count, setCount] = useState(0);
useEffect(() => {
document.title = `You clicked ${count} times`;
return () => {
document.title = 'React App';
};
}, [count]);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click here
</button>
</div>
);
}
Author: Vincent CotroStatus: PublishedQuestion passed 1207 times
Edit
6
Community EvaluationsNo one has reviewed this question yet, be the first!
Similar QuestionsMore questions about React