react-expiration

0.1.0 • Public • Published

React Expiration

A simple component that uses a render callback to expose if a the current date is past a user set expirationDate

Install

npm install react-expiration --save

Props

  • render - a function that receives a single boolean argument that will be true if the current date is past the expiration date and false if not
  • expirationDate - a date object indicating the date that will be used to determine the argument for the render function

Example

 
import Expiration from 'react-expiration';
<Expiration
  render={isExpired => isExpired ? "welcome to the year 3000" : "still the dumb 2000s"}
  expirationDate={new Date("12/31/2999")}
/>

License

MIT

Package Sidebar

Install

npm i react-expiration

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

3.99 kB

Total Files

8

Last publish

Collaborators

  • conorhastings