// sdk · React
Compañero React para @astroway/sdk
Oficial `@astroway/react` en npm — un envoltorio delgado al estilo Stripe para `@astroway/sdk`. `AstrowayProvider` eleva el cliente al contexto React; los ganchos `useAstroway`, `useAstrowayQuery`, `useNatalChart` devuelven una triple `{ data, error, loading }` al estilo SWR con cero dependencias externas. Funciona con React 18+, Next.js App Router (via "use client"), Vite, CRA.
// 01 / install
Instalar
npm install @astroway/react @astroway/sdk react importar: import { AstrowayProvider, useNatalChart } from '@astroway/react';
Ver en el registro → @astroway/react
// 02 / highlights
Características destacadas
- Contexto AstrowayProvider
- useAstrowayQuery + useNatalChart
- Cero dependencias
- Compañero al estilo Stripe
- Tipos TypeScript completos desde @astroway/sdk
// 03 / first request
Primera solicitud
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>;
} Empezar con React
10 000 créditos gratis al mes. SDK de código abierto, generado desde OpenAPI 3.1, siempre sincronizado con el backend.