Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

fetch is not defined error in React Native

Tags:

react-native

I am trying to use fetch in my project but there is an error saying

fetch is not defined

enter image description here

Someone knowing why?

like image 443
charbinary Avatar asked Feb 07 '17 08:02

charbinary


2 Answers

Is this a code style error? if so, you can disable that line according to your code styling library

If not, what you need to import to make it work is:

import "isomorphic-fetch";
like image 78
Jose Paredes Avatar answered Oct 20 '22 06:10

Jose Paredes


It might be better to add it in your .eslintrc config instead since the Fetch API is already included in React Native.

Details: https://github.com/eslint/eslint/issues/4015#issuecomment-301920490

like image 21
dijonkitchen Avatar answered Oct 20 '22 08:10

dijonkitchen