@tech-bureau/mijin-openapi-react-query-client
v1.0.0
Published
Auto-generated axios client from OpenAPI using orval
Readme
@tech-bureau/mijin-openapi-react-query-client
React Query-based OpenAPI client generated by orval
📦 Installation
npm install @tanstack/react-query @tech-bureau/mijin-openapi-react-query-client🚀 Usage
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useGetAccountInfo } from '@tech-bureau/mijin-openapi-react-query-client';
const queryClient = new QueryClient();
function AccountInfo({ address }: { address: string }) {
const { data, isLoading, error } = useGetAccountInfo(address, {
axios: { baseURL: "${YOUR_NODE_URL}" },
});
if (isLoading) return <p>Loading...</p>;
if (error) return <p>Error: {(error as Error).message}</p>;
return <pre>{JSON.stringify(data, null, 2)}</pre>;
}
function App() {
return (
<QueryClientProvider client={queryClient}>
<AccountInfo address="${YOUR_ADDRESS}" />
</QueryClientProvider>
);
}