# React and Python

Use Maxy from a React app or from Python. React ships in your partner kit (`npm install ./maxy-react-*.tgz`); Python installs from maxy.co, MIT licence: `pip install https://maxy.co/sdk/maxy-latest.tar.gz`. For a complete UI, see [the widget guide](https://maxy.co/guides/maxy-integration-guide.pdf).

```ts
import { MaxyProvider, usePrice } from '@maxy/react';

function Price() {
  const { data, error } = usePrice({ from: 'USDC on base', to: 'BTC', amount: '100' });
  return <p>{error ? error.message : data?.formatted?.receive}</p>;
}

export const App = () => <MaxyProvider config={{ apiKey: 'mxk_pk_test_…' }}><Price /></MaxyProvider>;
```

```python
from maxy import Maxy

maxy = Maxy()  # reads MAXY_API_KEY
print(maxy.prices.get("ETH on base", "BTC", "0.01")["formatted"]["receive"])
```

`@maxy/react` is hooks with no styles and no wallet, safe during server rendering. Put your publishable test key in place of `mxk_pk_test_…`. It only works from the origins Maxy issued it for: the one in your kit allows `localhost:3000`.

| Hook | Gives |
| --- | --- |
| `usePairs()` | The pairs, kept 60 seconds |
| `usePrice(params)` | A price, refreshed every 5 seconds |
| `useQuote(params)` | A quote, and `secondsLeft` |
| `useBuyBtc()`, `useBuyBtcWithSolana()` | `state`, `progress`, `error`, `result`, `start`, `retry`, `resume` |
| `useSellBtc()` | The same, and `paymentInstructions` |
| `useOrder(id)` | The order, live |

The `maxy` Python package has the same resources and names in snake_case, with `Maxy` and `AsyncMaxy`. It needs `httpx` and Python 3.10+. A whole order is in the Python tab on [First order](https://maxy.co/docs/first-order). Flow helpers that need a browser wallet stay in TypeScript.

---
Source: https://maxy.co/docs/react-and-python (Maxy Docs › SDK › Use it)
