Cubetiq React Hook useCountDown with trigger
dist | ||
example | ||
src | ||
.eslintignore | ||
.eslintrc.js | ||
.gitignore | ||
.npmignore | ||
.prettierignore | ||
.prettierrc | ||
babel.config.js | ||
jest.config.js | ||
package.json | ||
README.md | ||
tsconfig.json | ||
yarn-error.log |
React Countdown Hook
Installation
# NPM
npm i @cubetiq/react-use-countdown
# Yarn
yarn add @cubetiq/react-use-countdown
Example
import React from 'react';
import ReactDOM from 'react-dom';
import { useCountdown } from 'cubetiq-react-use-countdown';
const App = () => {
const { timeleft, start } = useCountdown();
return (
<div>
<button onClick={() => start(10000)}> Start Countdown </button>
<h1>Time left: {timeleft}</h1>
</div>
);
};
ReactDOM.render(<App />, document.querySelector('#root'));
Contributors
Project's repository: https://git.cubetiqs.com/CUBETIQ/react-use-countdown.git