npm.io
1.3.0 • Published 6 years ago

react-headless-countdown

Licence
MIT
Version
1.3.0
Deps
1
Size
3 kB
Vulns
0
Weekly
0

react-headless-countdown

React date countdown using render props. Support for hooks is on its way :)

NPM JavaScript Style Guide

Install

npm install --save react-headless-countdown

Usage

import React, { Component } from "react";

import DateCountdown from "react-headless-countdown";

class Example extends Component {
  render() {
    const date = new Date("2021-01-01"); // New year 2021!

    return (
      <DateCountdown date={date}>
        {({ timeLeft, isValidDate, isValidFutureDate }) => (
          <div>Render the countdown here!</div>
        )}
      </DateCountdown>
    );
  }
}

Example in action here. You can checkout the examples folder for how to use it.

License

MIT Param-Harrison