JavaScript
12
Вклад в тег
fetch('https://jsonplaceholder.typicode.com/albums')
.then(response => response.json())
.then(data => data.forEach((album) => {
document.body.insertAdjacentHTML('beforeEnd', `
<p>${album.userId}</p>
<p>${album.id}</p>
<p>${album.title}</p>
`)
}))
this.state = {
isAlertVisible: false
}
// ...
<Alert isVisible={this.state.isAlertVisible} />
handleClick = event => {
// ...
this.setState({isAlertVisible: true}, () => {
setTimeout(
() => {this.setState({isAlertVisible: false})},
3000
)
})
}