How to get the time in seconds after click on submit button using React Count Down Timer

const renderer = ({ hours, minutes, seconds }) => { 
        return <span>{hours}:{minutes}:{seconds}</span>;
    }
    
<span ><CountDown date={Date.now() + 18000}
renderer={renderer}/></span>
                                        
<button onClick={onButtonClick} >Submit</button>

i have used here react-countdown npm package

Once we load the page the timer will be on and I need to get the remaining time when click on submit button


It's not pretty but it works and I don't have time to make it prettier -- here ya go

import React from "react";
import ReactDOM from "react-dom";
import Countdown from "react-countdown";

// Random component
const Completionist = () => <span>You are good to go!</span>;

const renderer = ({ hours, minutes, seconds }) => {  return <span>{hours}:{minutes}:{seconds}</span>; }

const cd = <Countdown date = {Date.now() + 18000} rend={renderer}/>

const endDate = Date.now() + 18000


function onButtonClick() {
  const currentDate = Date.now();
  
  const diff = (currentDate - endDate) / -1000;
  console.log(diff)
  
}






ReactDOM.render(
  
  <><span>{cd}</span><button onClick={onButtonClick} >Submit</button></>,
  document.getElementById("root")
);