Create a component that changes the document title to the number of times a button is clicked.
MediumProblem Statement
Create a component that changes the document title to the number of times a button is clicked.
Sample Input
Initial click count: 0
Sample Output
Document title updates to Clicked 1 times, Clicked 2 times, etc.
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
import React, { useState, useEffect } from "react";
const ClickTracker = () => {
return (
<div>
<button>Click Me</button>
</div>
);
};
export default ClickTracker;
Input
Initial click count: 0
Expected Output
Document title updates to Clicked 1 times, Clicked 2 times, etc.