Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

https://github.com/jxom/react-t-minus

React component to handle simple countdowns
https://github.com/jxom/react-t-minus

Last synced: about 1 month ago
JSON representation

React component to handle simple countdowns

Lists

README

        

# React T-Minus

> A React component to handle countdowns

## Install

`npm install react-t-minus`

## Example

```jsx
import T from 'react-t-minus';

console.log('blast off!')}
onTick={({ secondsLeft }) => console.log(secondsLeft)}
>
{({ isComplete, secondsLeft }) =>
isComplete ? (
rocket launch
) : (

{secondsLeft} seconds until launch...

)
}

```

### More examples

- [Storybook](https://jxom.github.io/react-t-minus/)
- [Storybook Stories](https://github.com/jxom/react-t-minus/blob/master/src/__stories__/index.stories.js)

## Props

### minus

Type: `number`

The number (in seconds) to countdown from.

### onComplete

Type: `function()`

The function to invoke when the countdown is complete.

### onTick

Type: `function({ secondsLeft: number })`

The function to invoke per tick of the countdown. Also includes how many seconds are left (`secondsLeft`).

### Render props

#### isComplete

Type: `boolean`

Returns whether or not the countdown is complete

#### secondsLeft

Type: `number`

Returns the amount of seconds left

## License

MIT © [jxom](http://jxom.io)