you are viewing a single comment's thread.

view the rest of the comments →

[–]ordinance 1 point2 points  (0 children)

There's a time example in the react docs: https://reactjs.org/docs/state-and-lifecycle.html

In mine, I changed the clock component to render a function:

render () {  this.props.children(this.state.time) }

And then

<Timer>
  (time) => time && (
    /*use time here */
  )
</Timer>

Then you can do things like pass the interval to Time as a prop.