Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 676 Bytes

README.md

File metadata and controls

28 lines (23 loc) · 676 Bytes

Infinite scroll

Sessão de posts requisitados conforme a tela chega ao fim.

Os posts são chamados de uma API fake.

Como fazer requisição dos dados:

  • Url e configurações e pedido
const url = 'https://jsonplaceholder.typicode.com/posts&_limit=5$_page=1'
const config = {
    method: 'GET',
    headers: {
        'Content-type': 'application/json',
        'Accept': 'application/json',
    },
    cache: 'no-cache' // Opcional
}
  • Obtendo os dados
fetch(url, config)
    .then(response => response.json())
    .then(res => console.log(res))
    .catch(error => console.log(error)) // Em caso de erro