Skip to content

Abort fetches in react native #3

Closed
@giacomocerquone

Description

@giacomocerquone

Hi, I have a little problem... probably I'm misleading different specs.
I read this article on how to abort a fetch request: https://developers.google.com/web/updates/2017/09/abortable-fetch

and I'm trying to do so in react-native with your library ('cause the standard AbortController has yet to arrive) but it doesn't abort anything.

This is my code:

const controller = new AbortController();
const signal = controller.signal;

setTimeout(() => controller.abort(), 5000);

fetch(url, { signal }).then(response => {
  return response.text();
}).then(text => {
  console.log(text);
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions