react-use-countdown/example/src/index.js

16 lines
421 B
JavaScript
Raw Normal View History

import React from 'react';
import ReactDOM from 'react-dom';
import { useCountdown } from 'cubetiq-react-use-countdown';
2020-09-07 16:42:09 +07:00
const App = () => {
const { timeleft, start } = useCountdown();
return (
<div>
<button onClick={() => start(10000)}> Start Countdown </button>
<h1>Time left: {timeleft}</h1>
</div>
);
};
2020-09-07 16:42:09 +07:00
ReactDOM.render(<App />, document.querySelector('#root'));