function getPromise() {
return new Promise((resolve, reject) => {
setTimeout(() => resolve('готово'), 1000);
});
}
async function asyncCall() {
for (let i=0; i < 100; i++) {
console.log(await getPromise());
}
}
componentDidMount()
или useEffect()
обращаться к ref.current
const ref = useRef();
useEffect(() => {
const rect = ref.current.getBoundingClientRect();
});
return <div ref={ref} />;
myFunc.bind(this))
myFunct = () => {};