Cubetiq React Hook useCountDown with trigger
Go to file
2020-10-09 18:09:19 +07:00
dist fixed the publish and remove publish command 2020-09-19 16:06:18 +07:00
example updated package and information guide and add step for hook 2020-10-09 18:08:47 +07:00
src fixed the publish and remove publish command 2020-09-19 16:06:18 +07:00
.eslintignore init project 2020-08-28 14:32:14 +07:00
.eslintrc.js init project 2020-08-28 14:32:14 +07:00
.gitignore remove unused packages deps and updates example and installation 2020-10-09 18:03:01 +07:00
.npmignore add readme 2020-08-28 15:58:25 +07:00
.prettierignore init project 2020-08-28 14:32:14 +07:00
.prettierrc init project 2020-08-28 14:32:14 +07:00
babel.config.js init project 2020-08-28 14:32:14 +07:00
jest.config.js init project 2020-08-28 14:32:14 +07:00
package.json updated package and information guide and add step for hook 2020-10-09 18:08:47 +07:00
README.md updated package and information guide and add step for hook 2020-10-09 18:08:47 +07:00
tsconfig.json updated jest __tests__ 2020-09-19 08:04:43 +07:00

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 the countdown hook here
import { useCountdown } from 'cubetiq-react-use-countdown';

const App = () => {
    const { timeleft, start } = useCountdown({
        step: 1000,
    });

    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: React Countdown