React wrapper component for calling function periodically.
npm install --save react-periodical
open `index.html` file
import React, { Component } from 'react';
import Periodical from 'react-periodical';
class App extends Component {
doSomething() {
console.log('function called');
}
render () {
return (
<div>
<Periodical
f={() => this.doSomething()}
period={10000}
>
<ChildComponent {...childProps}/>
</Periodical>
//You can set component with props like below.
<Periodical
f={() => this.doSomething()}
period={5000}
components={[OtherChildComponent, AnotherChildComponent]}
/>
</div>
)
}
}
function that called periodically
time interval next function call (default : 1000 ms)
max limit count
if it is true, function call will be paused, with having current call count. (default : false)
[
PropTypes.arrayOf(
PropTypes.oneOfType([PropTypes.func, PropTypes.string])
),
PropTypes.oneOfType([PropTypes.func, PropTypes.string])
] )
just explicit child component.
You can understatnd directly this child or these children are effected by this function.
MIT