npm

Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

This package has been deprecated

Author message:

use reactjs/react-timer-mixin instead

react-timers

5.0.3 • Public • Published

react-timers

Version

A react setInterval/setTimeout mixin for mere mortals. Any intervals that are set are automatically cleared based on the component life cycle.

WARNING: If you are performing an async action, you should still check if the component is mounted.

Example

var Timers = require('react-timers')
 
module.exports = React.createClass({
    mixins: [Timers],
 
    componentDidMount: function () {
        var self = this
 
        this.setTimeout(function () {
            self.setState({ lastUpdated: new Date() })
        }, 1000)
 
        this.setInterval(function () {
            self.setState({ lastUpdated: new Date() })
        }, 1000)
    },
 
    render: function () {
        // ... etc
    }
})

LICENSE [MIT][LICENSE]

install

npm i react-timers

Downloadsweekly downloads

44

version

5.0.3

license

MIT

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
  • avatar
Report a vulnerability