Practice Real Company Assessment Patterns • Latest 2025–2026 Mock Tests

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

Try your code in this preview. Submit marks it done.

import React, { useState, useEffect } from "react";
 
 const ClickTracker = () => {
  return (
  <div>
  <button>Click Me</button>
  </div>
  );
 };
 
 export default ClickTracker;