Custom setInterval with timeout.
$ npm install use-interval-with-timeout
const useIntervalWithTimeout = require('use-interval-with-timeout');
const [currentIteration, cancelInterval] = useIntervalWithTimeout(
countdown => console.log(`countdown ${countdown}`),
() => console.log('done'),
1000,
30
);