Programming Exercises

Create a component that changes the document title to the number of times a button is clicked.

Medium

Problem 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;
Log in or sign up to run or submit your code.Log inSign up
Input
Initial click count: 0
Expected Output
Document title updates to Clicked 1 times, Clicked 2 times, etc.