react-interval-formatter
Update a value in realtime
Last updated 2 years ago by scupteam .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install react-interval-formatter 
SYNC missed versions from official npm registry.

react-interval-formatter

A React formatter that updates the element each 15 seconds

Demo

Install

yarn install react-interval-formatter

or

npm install react-interval-formatter --save

Properties

tag : string

The tag you want to rendered

formatter : function

A function that knows how to format the value prop

value : string

The value that is going to be passed to the formatter

othersProps

You can send any props you want, i.e.: onClick, className, etc...

Example

import IntervalFormatter from 'react-interval-formatter'

let multiplier = 1
const formatter = (value) =>
  `${value} * ${multiplier} = ${value * multiplier++}`

export default () => 
  <IntervalFormatter
    tag='label'
    formatter={formatter}
    value={10}
    className='ten-multiplier'
    onClick={() => alert('aaa')}
  />;

It will render
Instantly: <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>

Current Tags

  • 0.0.7                                ...           latest (2 years ago)

7 Versions

  • 0.0.7                                ...           2 years ago
  • 0.0.6                                ...           2 years ago
  • 0.0.5                                ...           2 years ago
  • 0.0.4                                ...           3 years ago
  • 0.0.3                                ...           3 years ago
  • 0.0.2                                ...           3 years ago
  • 0.0.1                                ...           3 years ago
Downloads
Today 0
This Week 0
This Month 7
Last Day 0
Last Week 0
Last Month 0
Dependencies (3)
Dev Dependencies (16)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |