Just use it like this
const interval = setInterval(() => {
getData();
}, 1000);
If you want to avoid making wrapper callback like above, you can just pass getData as a callback, which setInterval will call after each specified interval time i.e 1 second here
const interval = setInterval(getData, 1000);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…