0.1.0 • Published 6 years ago

react-expiration v0.1.0

Weekly downloads
2
License
MIT
Repository
-
Last release
6 years ago

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