AstroWay/api v2.254.12 · fr
tous les systèmes sont opérationnels
// sdk · React

Compagnon React pour @astroway/sdk

Officiel @astroway/react sur npm - une couche fine dans le style Stripe sur @astroway/sdk. AstrowayProvider élève le client dans le contexte React ; les hooks useAstroway, useAstrowayQuery, useNatalChart retournent un triple { data, error, loading } dans le style SWR avec zéro dépendances externes. Fonctionne avec React 18+, Next.js App Router (via "use client"), Vite, CRA.

// 01 / install

Installer

npm install @astroway/react @astroway/sdk react
pnpm pnpm add @astroway/react @astroway/sdk react
yarn yarn add @astroway/react @astroway/sdk react
bun bun add @astroway/react @astroway/sdk react

importation: import { AstrowayProvider, useNatalChart } from '@astroway/react';

// 02 / highlights

Fonctionnalités

// 03 / first request

Première requête

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>;
}

Démarrer avec React

10 000 crédits gratuits par mois. SDK open-source, généré à partir d'OpenAPI 3.1, toujours synchronisé avec le backend.

99,9% SLA · forfaits payants · 30 j statut →