react-interval-rerender

render props component that rerenders its children at regular intervals

Usage no npm install needed!

<script type="module">
  import reactIntervalRerender from 'https://cdn.skypack.dev/react-interval-rerender';
</script>

README

react-interval-rerender

CircleCI Coverage Status semantic-release Commitizen friendly npm version

Render props component that rerenders its children at regular intervals This is not the same as react-interval or react-interval-renderer.

Usage

npm install --save react-interval-rerender
import * as React from 'react'
import Interval from 'react-interval-rerender'

export const Clock = () => (
  <Interval delay={1000}>{() => new Date().toLocaleTimeString()}</Interval>
)

Props

delay?: ?number

The delay for setInterval. While !Number.isFinite(delay), no interval will be set. Whenever delay changes the interval will be reset.

children?: () => ?React.Node

Function to render the content. You can use this or render. children takes priority.

render?: () => ?React.Node

Function to render the content. You can use this or children.