<canvas id="myChart" width="400" height="400"></canvas>
const request = useCallback(async (url, method = 'GET', body = null, headers ={}) => {
setLoading(true)
try{
if (body) {
body = JSON.stringify(body)
headers['Content-Type'] = 'application/json'
}
const response = await fetch(url, {method, body, headers})
const data = await response.json()
if (! response.ok){
throw new Error(data.message || 'Что-то пошло не так')
}
setLoading(false)
return data
}catch(e){
setLoading(false)
setError(e.message)
throw e
}
}, [])
const hanldeTextEditor = () => {
let commands = [[3, 'a'], [1, 'b']]
let text = ''
commands.forEach((command)=>{
for (let i = 0; i < command[0]; i++)
text = text + command[1];
console.log(text);
})
}
hanldeTextEditor()
toBlock = document.querySelector(hash).getBoundingClientRect().top
window.addEventListener('scroll', () =>{
if(document.documentElement.scrollTop > 1650){
}else{
}