react-tick

Countdown timer for React

Usage no npm install needed!

<script type="module">
  import reactTick from 'https://cdn.skypack.dev/react-tick';
</script>

README

react-tick

Countdown timer for React

NPM version Downloads

react-tick

Installation

npm install react-tick

Usage

var React = require('react');
var Tick = require('react-tick');
var ReactDOM = require('react-dom');
ReactDOM.render(
    <Tick
        format="remain: {dd} days {hh} hours {mm} minutes {ss} seconds"
        endTime="2015/12/31 23:59:59"
        onTimeUp={onTimeUp} />,
    mountNode
);

Manifest

format

A string used to format the display string with some variables. HTML tags is supported.

  • dd remain days.
  • hh remain hours.
  • mm remain minutes.
  • ss remain seconds.

endTime

A string to indicate end time, the time format should be yyyy/MM/dd hh:mm:ss like 2012/12/31 23:59:59.

onTimeUp

A function will be executed when time is up.

License

MIT, see the LICENSE file for detail.