A React formatter that updates the element each 15 seconds
yarn install react-interval-formatter
or
npm install react-interval-formatter --save
The tag you want to rendered
A function that knows how to format the value prop
The value that is going to be passed to the formatter
You can send any props you want, i.e.: onClick, className, etc...
importIntervalFormatterfrom'react-interval-formatter'letmultiplier=1constformatter=(value)=>`${value} * ${multiplier} = ${value*multiplier++}`exportdefault()=><IntervalFormattertag='label'formatter={formatter}value={10}className='ten-multiplier'onClick={()=>alert('aaa')}/>;It will renderInstantly: <label class="ten-multiplier">10 * 1 = 10</div>15 seconds later: <label class="ten-multiplier">10 * 2 = 20</div>30 seconds later: <label class="ten-multiplier">10 * 3 = 30</div>