Skip to content

learnwithparam/react-headless-countdown

Repository files navigation

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>
    );
  }
}

You can checkout the examples folder for how to use it.

License

MIT © Param-Harrison