1.0.7 • Published 5 years ago

react-countdown-rp v1.0.7

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

react-countdown-rp

A React render prop component that counts down from now to a future time

Installation

$ npm install react-countdown-rp

Usage

Specify a future time (in milliseconds) in the endsAt prop. The countdown will stop once it reaches 0. The children function is passed secondsRemaining and msRemaining numbers that you can use to render elements.

import Countdown from 'react-countdown-rp';

// 10 second countdown
<Countdown endsAt={Date.now() + 10000}>
  {({secondsRemaining, msRemaining}) => (
    <div>
      <h1>{secondsRemaining}</h1>
      <h3>{msRemaining}</h3>
    </div>
  )}
</Countdown>

Props

NameTypeRequiredDescription
endsAtNumberyesMillseconds representing the end date (e.g. date.getTime())
childrenFunctionyesCalled with object {secondsRemaining, msRemaining} as the only argument
onCompletedFunctionnoFired when the countdown reaches 0
1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.0

5 years ago