In this guide we will cover two main cases:
- Ember specific library
- vendor library
The Ember library will assume that Ember has already ben loaded (higher in the loading order) and thus will assume it has access to the Ember API.
import React, { useEffect, useRef } from 'react'; | |
/** | |
* Use setInterval with Hooks in a declarative way. | |
* | |
* @see https://stackoverflow.com/a/59274004/3723993 | |
* @see https://overreacted.io/making-setinterval-declarative-with-react-hooks/ | |
*/ | |
export function useInterval( | |
callback: React.EffectCallback, |