
Security News
Socket Security Analysis Is Now One Click Away on npm
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.
@acrool/react-fetcher
Advanced tools
Acrool React Fetcher is a solution for API integration and Auth state management in React projects. It helps you easily manage tokens, make API requests, perform GraphQL queries, and handle authentication flows.
A solution for API integration and token management in React projects
yarn add @acrool/react-fetcher
Add the following to your entry file (e.g. index.tsx):
import "@acrool/react-fetcher/dist/index.css";
Wrap your app with AuthStateProvider and AxiosClientProvider. It is recommended to use AppFetcherProvider to automatically wrap all necessary providers:
import AppFetcherProvider from '@/library/acrool-react-fetcher';
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
<AppFetcherProvider>
<App />
</AppFetcherProvider>
);
For Redux Toolkit Query, create baseApi.ts:
import { createGraphQLFetcher } from '@acrool/react-fetcher';
import { createApi } from '@reduxjs/toolkit/query/react';
import { axiosInstance } from '@/library/acrool-react-fetcher';
export const baseApi = createApi({
reducerPath: 'api',
baseQuery: async (query, api, extraOptions) => {
// Token handling and refresh are managed automatically
const data = await createGraphQLFetcher(axiosInstance, query.document)(query.args);
return { data };
},
endpoints: () => ({}),
});
import { useAuthState } from '@acrool/react-fetcher';
const { getTokens, updateTokens } = useAuthState();
const { data, refetch } = useGetBookmarkQuery({ variables: { bookmarkId: '1' } });
const handleMockTokenInvalid = () => {
updateTokens(curr => ({
...curr,
accessToken: 'mock-invalid-token',
}));
refetch();
};
const login = useLogin();
const logout = useLogout();
await login({ variables: { input: { account, password } } });
logout();
FAQs
Fetcher library based for Reactjs
The npm package @acrool/react-fetcher receives a total of 98 weekly downloads. As such, @acrool/react-fetcher popularity was classified as not popular.
We found that @acrool/react-fetcher demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers 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
npm now links to Socket's security analysis on every package page. Here's what you'll find when you click through.

Security News
A compromised npm publish token was used to push a malicious postinstall script in cline@2.3.0, affecting the popular AI coding agent CLI with 90k weekly downloads.

Product
Socket is now scanning AI agent skills across multiple languages and ecosystems, detecting malicious behavior before developers install, starting with skills.sh's 60,000+ skills.