React date countdown using render props. Support for hooks is on its way :)
npm install --save react-headless-countdown
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.
MIT © Param-Harrison