The IdleTimer was rewritten from scratch in v5, and the usage changed completely. They do have an example of how use it "the old way", but it's written for class based components. I need help translating that to a functional component.
This is their example:
import { Component } from 'react'
import { withIdleTimer } from 'react-idle-timer'
class IdleTimerComponent extends Component {
render () {
return this.props.children
}
}
export const IdleTimer = withIdleTimer(IdleTimerComponent)
and then use it like this from the app:
render () {
return (
<>
<IdleTimer
ref={ref => { this.idleTimer = ref }}
timeout={1000 * 60 * 15}
promptTimeout={1000 * 30}
onPrompt={this.onPrompt}
onIdle={this.onIdle}
onAction={this.onAction}
onActive={this.onActive}
startManually
/>
<HomePage />
</>
)
}
How do I do this in a functional component?