{"id":18715,"library":"react-native-http","title":"React Native HTTP","description":"React Native HTTP is a lightweight HTTP service wrapper for React Native applications, designed to simplify API interactions with built-in JWT token handling. Version 0.0.3 is the latest stable release, but the package appears to be in early development with sparse documentation. It provides an abstract base class HTTPService that supports GET, POST, PUT, DELETE methods with automatic token management (Authorization header, Bearer prefix, storage key). Key differentiators: minimal overhead, token lifecycle handled internally, supports per-request authorization skipping. However, it lacks TypeScript definitions, testing, and a clear roadmap; alternatives like axios or react-native-netinfo are more mature. The project is currently in maintenance mode with infrequent updates.","status":"active","version":"0.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/iktw/react-native-http","tags":["javascript","react-native-component","react-component","react","native","jwt","http"],"install":[{"cmd":"npm install react-native-http","lang":"bash","label":"npm"},{"cmd":"yarn add react-native-http","lang":"bash","label":"yarn"},{"cmd":"pnpm add react-native-http","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export is not provided; use named import for HTTPService class.","wrong":"import HTTPService from 'react-native-http'","symbol":"HTTPService","correct":"import { HTTPService } from 'react-native-http'"},{"note":"CommonJS require must access the named export .HTTPService, not the module itself.","wrong":"const HTTPService = require('react-native-http')","symbol":"HTTPService","correct":"const HTTPService = require('react-native-http').HTTPService"},{"note":"Destructuring require works as well.","wrong":"","symbol":"HTTPService","correct":"const { HTTPService } = require('react-native-http')"}],"quickstart":{"code":"import { HTTPService } from 'react-native-http';\n\nclass MyAPI extends HTTPService {\n  getUsers() {\n    return this.get('users/');\n  }\n\n  createUser(data) {\n    return this.post('users/', data);\n  }\n}\n\nconst api = new MyAPI('https://api.example.com');\napi.getUsers().then(response => console.log(response)).catch(error => console.error(error));","lang":"javascript","description":"Creates a custom API class extending HTTPService with GET and POST methods, then instantiates it and calls getUsers."},"warnings":[{"fix":"Consider switching to @react-native-async-storage/async-storage as a polyfill, or implement custom token storage.","message":"The package relies on react-native AsyncStorage for token storage; if AsyncStorage is removed in newer RN versions, token handling will fail.","severity":"gotcha","affected_versions":">=0.0.3"},{"fix":"Always pass options as the third argument; for GET and DELETE, the second argument (body) should be null if not needed.","message":"The skipAuthorization option must be passed as the third parameter to methods (e.g., this.get(path, null, {skipAuthorization: true})). Omitting it or placing it incorrectly will not skip authorization.","severity":"gotcha","affected_versions":">=0.0.3"},{"fix":"Wrap calls in try-catch or add .catch handlers to inspect error objects.","message":"The package does not handle network errors gracefully; HTTP errors may reject the promise without detailed status codes.","severity":"breaking","affected_versions":">=0.0.3"}],"env_vars":null,"last_verified":"2026-04-25T00:00:00.000Z","next_check":"2026-07-24T00:00:00.000Z","problems":[{"fix":"Use named import: import { HTTPService } from 'react-native-http'","cause":"Default import used but package only exports named exports.","error":"TypeError: _reactNativeHttp.default is not a function"},{"fix":"Run npm install react-native-http --save","cause":"Package is not installed or is in development mode.","error":"Cannot find module 'react-native-http'"},{"fix":"Ensure the HTTPService constructor is called with a baseURL and that the storageTokenPrefix (default: react_native_http_jwt_token) is set in AsyncStorage.","cause":"JWT token handling requires that the underlying HTTPService sets jwtService before calling methods that expect token.","error":"undefined is not an object (evaluating 'this.jwtService.setToken')"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}