
Security News
Axios Supply Chain Attack Reaches OpenAI macOS Signing Pipeline, Forces Certificate Rotation
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.
@simple-api/react-native
Advanced tools
The mobile-optimized adapter for simple-api.
@simple-api/react-native is a specialized wrapper around @simple-api/react, specifically tuned for the mobile environment. It ensures that your API engine performs optimally on iOS and Android devices, focusing on battery efficiency and shared logic.
npm install @simple-api/react-native @simple-api/core @tanstack/react-query
One of the greatest strengths of simple-api is sharing your API definition between Web and Mobile:
// shared/api.ts
import { createApi } from "@simple-api/core";
export const apiDefinition = createApi({
baseUrl: "https://api.myapp.com",
services: {
auth: {
login: { method: "POST", path: "/auth/login" },
},
content: {
list: { method: "GET", path: "/items" },
},
},
});
// hooks/useApi.ts (Mobile Project)
import { createReactAdapter } from "@simple-api/react-native";
import { apiDefinition } from "../shared/api";
export const useMobileApi = createReactAdapter(apiDefinition);
import React from "react";
import { View, Text, ActivityIndicator } from "react-native";
import { useMobileApi } from "../hooks/useApi";
export const FeedScreen = () => {
const { content } = useMobileApi();
const { data, isLoading, error } = content().list();
if (isLoading) return <ActivityIndicator color="#0000ff" />;
if (error) return <Text>Error loading items</Text>;
return (
<View>
{data.map((item) => (
<Text key={item.id}>{item.title}</Text>
))}
</View>
);
};
Mobile networks are often flaky. We recommend using the createRetryMiddleware in your core definition:
import { createRetryMiddleware } from "@simple-api/core";
// In your shared api definition:
middleware: [createRetryMiddleware({ maxRetries: 3 })];
Use hookOptions in your screens to control how long data stays in memory:
content().list({
hookOptions: {
staleTime: 1000 * 60 * 5, // 5 minutes
gcTime: 1000 * 60 * 60, // Keep in memory for 1 hour
},
});
When a user navigates away from a screen, this adapter (powered by TanStack Query) automatically cancels pending network requests using AbortController, ensuring your app stays responsive and battery-efficient.
MIT © Elnatan Samuel
FAQs
React Native adapter for SimpleAPI Engine
The npm package @simple-api/react-native receives a total of 21 weekly downloads. As such, @simple-api/react-native popularity was classified as not popular.
We found that @simple-api/react-native demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
OpenAI rotated macOS signing certificates after a malicious Axios package reached its CI pipeline in a broader software supply chain attack.

Security News
Open source is under attack because of how much value it creates. It has been the foundation of every major software innovation for the last three decades. This is not the time to walk away from it.

Security News
Socket CEO Feross Aboukhadijeh breaks down how North Korea hijacked Axios and what it means for the future of software supply chain security.