// sdk · React
React companion for @astroway/sdk
Official `@astroway/react` on npm — a thin Stripe-style wrapper over `@astroway/sdk`. `AstrowayProvider` lifts the client into React context; `useAstroway`, `useAstrowayQuery`, `useNatalChart` hooks return an SWR-style `{ data, error, loading }` triple with zero external deps. Works with React 18+, Next.js App Router (via "use client"), Vite, CRA.
// 01 / install
Install
npm install @astroway/react @astroway/sdk react import: import { AstrowayProvider, useNatalChart } from '@astroway/react';
View on registry → @astroway/react
// 02 / highlights
Highlights
- AstrowayProvider context
- useAstrowayQuery + useNatalChart
- Zero deps beyond react
- Stripe-style companion
- Full TypeScript types from @astroway/sdk
// 03 / first request
Make your first request
import { AstrowayProvider, useNatalChart } from '@astroway/react';
function App() {
return (
<AstrowayProvider options={{ apiKey: import.meta.env.VITE_AW_KEY }}>
<Chart />
</AstrowayProvider>
);
}
function Chart() {
const { data, error, loading } = useNatalChart({
date: '1990-07-14',
time: '14:30:00',
timezoneOffset: 3,
latitude: 50.4501,
longitude: 30.5234,
});
if (loading) return <p>Loading…</p>;
if (error) return <p>Error: {error.message}</p>;
return <pre>{JSON.stringify(data, null, 2)}</pre>;
} Start building with React
10,000 credits free per month. Open-source SDK, generated from OpenAPI 3.1, always in sync with the backend.