Invoke the callback after the next repaint, while the requestAnimationFrame invokes the callback before the next repaint.
- Install the package
npm install raf-after -S
- Import the module in the place you want to use:
import rafAfter from 'raf-after';
rafAfter(function () => {
// do what you want after next repaint
});